当前位置: 首页>>代码示例>>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;未经允许,请勿转载。