Python 我如何从poloniex拿到所有的股票

Python 我如何从poloniex拿到所有的股票,python,history,ticker,poloniex,Python,History,Ticker,Poloniex,我正在使用从这个python包获得的函数:polo.returnTicker()['BTC_ETH']从Poloniex获取当前的ticker。函数返回一个json对象,如下所示: {u'last':u'0.07120000',u'quoteEvolume':u'3523.11980704',u'high24hr':u'0.07170000',u'isfreezed':u'0',u'highestBid':u'0.07120026',u'percentChange':u'-0.00154256'

我正在使用从这个python包获得的函数:
polo.returnTicker()['BTC_ETH']
从Poloniex获取当前的ticker。函数返回一个json对象,如下所示:

{u'last':u'0.07120000',u'quoteEvolume':u'3523.11980704',u'high24hr':u'0.07170000',u'isfreezed':u'0',u'highestBid':u'0.07120026',u'percentChange':u'-0.00154256',u'low24hr':u'0.070707078026',u'lowstask':u'0.07120370',u'id':148 u'baseVolume':u'251.02174618'


但是,我需要一个数组,在一分钟的时间间隔内包含过去的所有代码,我不知道如何获取这些代码。我的函数只能返回当前的ticker,而不能返回我需要的过去的ticker。有人知道怎么做吗

由于Poloniex不提供ticker历史记录,您必须定期请求ticker,然后将结果存储在文件、json或数据库中。然后读取您的文件、本地json或数据库以返回一个过去的ticker数组

您可以使用类似的内容(文件版本):

然后你可以:

  • period\u in_s=5
    更改为
    period\u in_s=60
    ,以在一分钟的间隔内抓取股票行情
  • max\u history\u size=x
    以满足您的历史记录大小要求
  • 将您的代码放入
    #在此处完成您的工作部分
这给了你:

We get new ticker

do the job with history (here we show the  1 last price)
0.03102500

We get new ticker

do the job with history (here we show the  2 last price)
0.03102500
0.03102500

We get new ticker

do the job with history (here we show the  3 last price)
0.03102500
0.03102500
0.03102500

We get new ticker

do the job with history (here we show the  3 last price)
0.03102500
0.03102500
0.03102500

[...]
We get new ticker

do the job with history (here we show the  1 last price)
0.03102500

We get new ticker

do the job with history (here we show the  2 last price)
0.03102500
0.03102500

We get new ticker

do the job with history (here we show the  3 last price)
0.03102500
0.03102500
0.03102500

We get new ticker

do the job with history (here we show the  3 last price)
0.03102500
0.03102500
0.03102500

[...]