當前位置: 首頁>>代碼示例>>Python>>正文


Python poloniex.Poloniex方法代碼示例

本文整理匯總了Python中poloniex.Poloniex方法的典型用法代碼示例。如果您正苦於以下問題:Python poloniex.Poloniex方法的具體用法?Python poloniex.Poloniex怎麽用?Python poloniex.Poloniex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在poloniex的用法示例。


在下文中一共展示了poloniex.Poloniex方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import poloniex [as 別名]
# 或者: from poloniex import Poloniex [as 別名]
def __init__(self):
        self._polo = Poloniex()
        #connect the internet to accees volumes
        vol = self._polo.marketVolume()
        pairs = []
        coins = []
        volumes = []

        for k, v in vol.iteritems():
            if k.startswith("BTC_") or k.endswith("_BTC"):
        	pairs.append(k)
                for c, val in v.iteritems():
                    if c != 'BTC':
    		        coins.append(c)
	            else:
		        volumes.append(float(val))

        self._df = pd.DataFrame({'coin': coins, 'pair': pairs, 'volume': volumes})
	self._df = self._df.set_index('coin') 
開發者ID:kumkee,項目名稱:SURF2016,代碼行數:21,代碼來源:coinlist.py

示例2: __init__

# 需要導入模塊: import poloniex [as 別名]
# 或者: from poloniex import Poloniex [as 別名]
def __init__(self):
        self.ticker = poloniex.Poloniex().returnTicker()
        # self._appRunner = ApplicationRunner(
                    # u"wss://api.poloniex.com:443", u"realm1"
                    # )
        # self._appProcess, self._tickThread = None, None
        # self._running = False 
開發者ID:cybertraders,項目名稱:bitcoin_arb,代碼行數:9,代碼來源:queuedTicker.py

示例3: __init__

# 需要導入模塊: import poloniex [as 別名]
# 或者: from poloniex import Poloniex [as 別名]
def __init__(self, APIKey, Secret, dataDir, dataQueue, orderQueue, instructionQueue):
        self.polo = poloniex.Poloniex(APIKey, Secret)

        self.dataQueue = dataQueue
        self.orderQueue = orderQueue
        self.instructionQueue = instructionQueue

        self.DATA_DIR = dataDir

        Thread.__init__(self)
        self.daemon = True 
開發者ID:GooTZ,項目名稱:poloTrader,代碼行數:13,代碼來源:DataProvider.py

示例4: test_method_integrity

# 需要導入模塊: import poloniex [as 別名]
# 或者: from poloniex import Poloniex [as 別名]
def test_method_integrity(self):
        self.polo = poloniex.Poloniex()
        for command in poloniex.PUBLIC_COMMANDS:
            self.assertTrue(hasattr(self.polo, command))
        for command in poloniex.PRIVATE_COMMANDS:
            self.assertTrue(hasattr(self.polo, command))
        self.assertTrue(hasattr(self.polo, 'marketTradeHist')) 
開發者ID:daljeetv,項目名稱:crypto,代碼行數:9,代碼來源:test.py

示例5: test_coach_existance

# 需要導入模塊: import poloniex [as 別名]
# 或者: from poloniex import Poloniex [as 別名]
def test_coach_existance(self):
        self.polo = poloniex.Poloniex()
        # coach is created by default
        self.assertTrue(isinstance(self.polo.coach, poloniex.Coach))
        # remove coach
        self.polo = poloniex.Poloniex(coach=False)
        self.assertFalse(self.polo.coach)
        # coach injection
        myCoach = poloniex.Coach()
        self.polo = poloniex.Poloniex(coach=myCoach)
        self.polo2 = poloniex.Poloniex(coach=myCoach)
        self.assertTrue(self.polo.coach is self.polo2.coach) 
開發者ID:daljeetv,項目名稱:crypto,代碼行數:14,代碼來源:test.py

示例6: test_PoloniexErrors

# 需要導入模塊: import poloniex [as 別名]
# 或者: from poloniex import Poloniex [as 別名]
def test_PoloniexErrors(self):
        self.polo = poloniex.Poloniex()
        # no keys, private command
        with self.assertRaises(poloniex.PoloniexError):
            self.polo.returnBalances()
        # invalid command
        with self.assertRaises(poloniex.PoloniexError):
            self.polo('foo')
        # catch errors returned from poloniex.com
        with self.assertRaises(poloniex.PoloniexError):
            self.polo.returnOrderBook(currencyPair='atestfoo') 
開發者ID:daljeetv,項目名稱:crypto,代碼行數:13,代碼來源:test.py

示例7: __init__

# 需要導入模塊: import poloniex [as 別名]
# 或者: from poloniex import Poloniex [as 別名]
def __init__(self):
        args = self.arg_parser.parse_known_args()[0]
        super(Polo, self).__init__()
        api_key = args.polo_api_key
        secret = args.polo_secret
        self.transaction_fee = float(args.polo_txn_fee)
        self.polo = Poloniex(api_key, secret)
        self.buy_order_type = args.polo_buy_order
        self.sell_order_type = args.polo_sell_order
        self.verbosity = args.verbosity
        self.pair_delimiter = '_'
        self.tickers_cache_refresh_interval = 50  # If the ticker request is within the interval, get data from cache
        self.last_tickers_fetch_epoch = 0  #
        self.last_tickers_cache = None  # Cache for storing immediate tickers 
開發者ID:miti0,項目名稱:mosquito,代碼行數:16,代碼來源:polo.py

示例8: get_symbol_ticker

# 需要導入模塊: import poloniex [as 別名]
# 或者: from poloniex import Poloniex [as 別名]
def get_symbol_ticker(self, symbol, candle_size=5):
        """
        Returns real-time ticker Data-Frame for given symbol/pair
        Info: Currently Poloniex returns tickers for ALL pairs. To speed the queries and avoid
              unnecessary API calls, this method implements temporary cache
        """
        epoch_now = int(time.time())
        if epoch_now < (self.last_tickers_fetch_epoch + self.tickers_cache_refresh_interval):
            # If the ticker request is within cache_fetch_interval, try to get data from cache
            pair_ticker = self.last_tickers_cache[symbol].copy()
        else:
            # If cache is too old fetch data from Poloniex API
            try:
                ticker = self.polo.returnTicker()
                pair_ticker = ticker[symbol]
                self.last_tickers_fetch_epoch = int(time.time())
                self.last_tickers_cache = ticker.copy()
            except (PoloniexError | JSONDecodeError) as e:
                print(colored('!!! Got exception in get_symbol_ticker. Details: ' + str(e), 'red'))
                pair_ticker = self.last_tickers_cache[symbol].copy()
                pair_ticker = dict.fromkeys(pair_ticker, None)

        df = pd.DataFrame.from_dict(pair_ticker, orient="index")
        df = df.T
        # We will use 'last' price as closing one
        df = df.rename(columns={'last': 'close', 'baseVolume': 'volume'})
        df['close'] = df['close'].astype(float)
        df['volume'] = df['volume'].astype(float)
        df['pair'] = symbol
        df['date'] = int(datetime.datetime.utcnow().timestamp())
        return df 
開發者ID:miti0,項目名稱:mosquito,代碼行數:33,代碼來源:polo.py

示例9: __init__

# 需要導入模塊: import poloniex [as 別名]
# 或者: from poloniex import Poloniex [as 別名]
def __init__(self):
        self.name = 'POLONIEX'
        self.public_api = poloniex.Poloniex()
        self.private_api = poloniex.Poloniex(config_key.poloniex_api_key, config_key.poloniex_secret_key)
        # This is the taker fee for a 30 day volume of <600BTC
        # in this arbitrage strategy we do not make orders, only fill(take) existing ones thus we apply the taker fee
        self.trading_fee = 0.25 
開發者ID:suhithr,項目名稱:bitcoin-arbitrage-bot,代碼行數:9,代碼來源:poloniex.py

示例10: __init__

# 需要導入模塊: import poloniex [as 別名]
# 或者: from poloniex import Poloniex [as 別名]
def __init__(self):
        self.api = Poloniex() 
開發者ID:alifanov,項目名稱:algotrading,代碼行數:4,代碼來源:download_bars.py


注:本文中的poloniex.Poloniex方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。