0

I've been trying to fetch historical data for the last few months of a particular pair, using 4 hours intervals. I was directed to the following format to fetch data:

https://poloniex.com/public?command=returnOrderBook&currencyPair=BTC_ETH

But is there a way I can specify duration and time interval using these links?

This link above only returns a very small amount of data:

{"asks":[["0.07294262",3.85122249],["0.07294900",2.26083751],["0.07295000",0.27748267],["0.07297000",34.27004797],["0.07299956",9.30579032],["0.07300000",103.64388503],["0.07300018",0.72164225],["0.07300074",0.12641927],["0.07300121",0.03214637],["0.07300333",0.96234537],["0.07300529",0.053669],["0.07300748",0.01492704],["0.07301000",0.01382964],["0.07301075",0.02986241],["0.07301130",0.00511563],["0.07301925",0.06533743],["0.07302025",0.68858894],["0.07302388",0.00687104],["0.07302902",9.97493],["0.07302950",0.0484817],["0.07303112",2.38806309],["0.07303301",0.00197615],["0.07303370",0.00482243],["0.07303883",0.00414447],["0.07304410",0.00273807],["0.07304678",0.00543898],["0.07305040",0.01992],["0.07305356",0.0020625],["0.07305401",0.01992],["0.07305983",0.00824112],["0.07306577",0.00197615],["0.07306612",0.00594431],["0.07306892",0.002339],["0.07306967",0.01719775],["0.07307227",0.10283005],["0.07307859",0.002],["0.07308270",0.00510212],["0.07308420",0.002],["0.07308426",0.01724074],["0.07309242",0.02155794],["0.07309631",95.1377819],["0.07309632",49.76001349],["0.07309859",0.002],["0.07310000",31.31704335],["0.07310171",4.36135985],["0.07310212",137.17830882],["0.07310813",0.00621748],["0.07310819",0.00207332],["0.07310827",0.00245133],["0.07311173",0.029925]],"bids":[["0.07293000",4.09621352],["0.07289104",1],["0.07286573",13.56110606],["0.07286570",7.29719389],["0.07286206",6.75617681],["0.07284000",0.3823122],["0.07280223",15.63],["0.07280222",11.55307627],["0.07280000",3.26644858],["0.07279168",16],["0.07277763",3.49124993],["0.07275720",0.00516941],["0.07275307",2.90757784],["0.07275001",97.51342245],["0.07275000",17.74562526],["0.07274078",14.1],["0.07271471",12.37463714],["0.07270471",12.9],["0.07270230",0.00515932],["0.07270000",13.82385472],["0.07266474",14.7],["0.07265576",0.02465678],["0.07265458",0.09348869],["0.07265391",0.00963472],["0.07264610",0.00518762],["0.07263973",0.01514323],["0.07263608",0.02753452],["0.07262454",14.09],["0.07260920",0.00517377],["0.07260001",264.79356832],["0.07260000",28.09911486],["0.07258836",0.01253133],["0.07258678",14],["0.07258191",6.48535134],["0.07258160",1.93865965],["0.07257285",0.02163167],["0.07256098",0.24371694],["0.07255820",0.00515266],["0.07255422",0.21470731],["0.07255235",0.01585062],["0.07254862",0.22614504],["0.07254528",14],["0.07254433",0.01929854],["0.07253970",0.2],["0.07253112",0.25],["0.07252819",0.03338578],["0.07251200",0.02836056],["0.07250826",1.07484],["0.07250245",0.17763637],["0.07250000",76.3954694]],"isFrozen":"0","seq":408169450}

with no real specification of when these data points come from or what exactly they mean.

Thanks very much.

-Colin

Phani Kumar M
  • 4,564
  • 1
  • 14
  • 26

2 Answers2

0

The Poloniex API documentation is very scarce. For orderbook entries you can specify depth:

https://poloniex.com/public?command=returnOrderBook&currencyPair=BTC_NXT&depth=100

This way you get more or less entries for bids and asks.

From what I can gather (from their support page and forums) you cannot specify a time frame for when these orders have been placed. This command shows you all of the active orders at a particular moment in time. By using their websocket you can also get a live feed of the order book.

0

From the API Documentation:

returnOrderBook

Returns the order book for a given market, as well as a sequence number for use with the Push API and an indicator specifying whether the market is frozen. You may set currencyPair to "all" to get the order books of all markets. Sample output:

{"asks":[[0.00007600,1164],[0.00007620,1300], ... ], "bids":[[0.00006901,200],[0.00006900,408], ... ], "isFrozen": 0, "seq": 18849}

Or, for all markets:

{"BTC_NXT":{"asks":[[0.00007600,1164],[0.00007620,1300], ... ], "bids":[[0.00006901,200],[0.00006900,408], ... ], "isFrozen": 0, "seq": 149},"BTC_XMR":...}

Call: https://poloniex.com/public?command=returnOrderBook&currencyPair=BTC_NXT&depth=10

Therefore (as Florin Alexandru already mentioned) you'll need to add the 'depth' query parameter.

The data consists of tuples for both asks and bids. The first number is the price of this entry, the second is the (maximum) amount sold/bought for that entry.


If you don't need the actual offers, I'd advice using returnChartData:

returnChartData

Returns candlestick chart data. Required GET parameters are "currencyPair", "period" (candlestick period in seconds; valid values are 300, 900, 1800, 7200, 14400, and 86400), "start", and "end". "Start" and "end" are given in UNIX timestamp format and used to specify the date range for the data returned. Sample output:

[{"date":1405699200,"high":0.0045388,"low":0.00403001,"open":0.00404545,"close":0.00427592,"volume":44.11655644, "quoteVolume":10259.29079097,"weightedAverage":0.00430015}, ...]

Call: https://poloniex.com/public?command=returnChartData&currencyPair=BTC_XMR&start=1405699200&end=9999999999&period=14400

Cyphrags
  • 528
  • 1
  • 7
  • 16