Exemple #1
0
def getSearchTerms():
    import json
    from poloniex import Poloniex
    polo = Poloniex()

    eventNames = [
        "upgrade", "updates", "releas", "testing", "aplha", "beta", "announce",
        "interview", "major", "launch", "add", "improve", "v1"
    ]
    coinMarketList = [
        market[market.index("_") + 1:]
        for market in polo.return24hVolume().keys() if "BTC_" in market
    ]
    coinList = polo.returnCurrencies()
    coinNames = []
    ignoredCoins = [
        "burst", "clams", "counterparty", "expanse", "dash", "horizon", "magi",
        "nem", "nexium", "nxt", "omni", "radium", "ripple", "shadow",
        "stellar", "tether"
    ]
    for coin in coinList:
        if not coinList[coin]["name"].lower(
        ) in ignoredCoins and coin in coinMarketList:
            coinNames.append(coinList[coin]["name"].lower())
    return [coinNames, eventNames]
Exemple #2
0
def getCoinNames(minVol):
  from poloniex import Poloniex
  api =  Poloniex()
  coinList = []
  coins = api.return24hVolume()
  for market in coins:
    if "BTC_" in market and float(coins[market]["BTC"]) > minVol:
      coinList.append(market.replace("BTC_","") + "-btc")
  coinList = [substitutedNames[x] if x in substitutedNames else x for x in coinList]
  return coinList
Exemple #3
0
def getCoinNames():
    from poloniex import Poloniex
    polo = Poloniex()
    config = getConfig()
    coinMarketList = [
        market[market.index("_") + 1:]
        for market in polo.return24hVolume().keys() if "BTC_" in market
    ]
    coinList = polo.returnCurrencies()
    coinNames = {}
    ignoredCoins = config["ignoredCoins"]
    for coin in coinList:
        if not coinList[coin]["name"].lower(
        ) in ignoredCoins and coin in coinMarketList:
            coinNames[coinList[coin]["name"].lower()] = "BTC_" + coin.upper()
    return coinNames
class TestPoloniex(object):

    def setup(self):
        self.poloniex = Poloniex('', '')

    def test_ticker(self):
        res = self.poloniex.returnTicker()

        assert 'BTC_ETH' in res.keys()
        assert 'lowestAsk' in res['BTC_ETH'].keys()
        
    def test_volume(self):
        res = self.poloniex.return24hVolume()
        
        assert 'BTC_ETH' in res.keys()
        assert 'BTC' in res['BTC_ETH'].keys()
        
    def test_orderbook(self):
        res = self.poloniex.returnOrderBook('BTC_ETH')
        assert 'bids' in res.keys()
        assert 'asks' in res.keys()
        
    def test_tradehistory(self):
        start = datetime.now() - timedelta(hours=1)
        res = self.poloniex.returnTradeHistory('BTC_ETH', start)

        assert len(res)
        assert 'date' in res[0].keys()
        assert 'type' in res[0].keys()
        assert 'amount' in res[0].keys()
        assert 'rate' in res[0].keys()

    def test_chartdata(self):
        start = datetime.now() - timedelta(hours=1)
        res = self.poloniex.returnChartData('BTC_ETH', 300, start)

        assert len(res)
        assert 'date' in res[0].keys()
        assert 'volume' in res[0].keys()
        assert 'high' in res[0].keys()
        assert 'low' in res[0].keys()
        assert 'close' in res[0].keys()