Closed dcolley closed 6 years ago
I don't use this lib,, but sources contain OrderBook, so does it fail with a capital 'O' also ?
I tried that. OrderBook exists, but does not work as the REST API is documented.
You can use make use of oandapyV20 instead, it supports that. You can use v20 and oandapyV20 parallel, so for a quick hack you use only oandapyV20 for the orderbook info.
from command line:
curl \
--compressed \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <AUTHENTICATION TOKEN>" \
"https://api-fxtrade.oanda.com/v3/instruments/USD_JPY/orderBook"
returns:
{"orderBook":{
"instrument":"USD_JPY","time":"2018-09-28T12:40:00Z","unixTime":"1538138400","price":"113.437","bucketWidth":"0.050",
"buckets":[
{"price":"0.000","longCountPercent":"0.0071","shortCountPercent":"0.0000"},
{"price":"0.100","longCountPercent":"0.0214","shortCountPercent":"0.0214"},
{"price":"0.150","longCountPercent":"0.0071","shortCountPercent":"0.0285"},
{"price":"0.200","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"0.300","longCountPercent":"0.0000","shortCountPercent":"0.0142"},
{"price":"0.400","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"0.500","longCountPercent":"0.0071","shortCountPercent":"0.0071"},
{"price":"0.600","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"0.700","longCountPercent":"0.0214","shortCountPercent":"0.0071"},
{"price":"0.800","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"0.850","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"0.900","longCountPercent":"0.0000","shortCountPercent":"0.0142"},
{"price":"0.950","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"1.000","longCountPercent":"0.1638","shortCountPercent":"0.0783"},
{"price":"1.050","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"1.100","longCountPercent":"0.0071","shortCountPercent":"0.0142"},
{"price":"1.150","longCountPercent":"0.0071","shortCountPercent":"0.0000"},
{"price":"1.200","longCountPercent":"0.0142","shortCountPercent":"0.0071"},
{"price":"1.300","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"1.400","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"1.500","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"1.600","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"1.700","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"1.750","longCountPercent":"0.0142","shortCountPercent":"0.0000"},
{"price":"1.800","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"1.900","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"2.000","longCountPercent":"0.0000","shortCountPercent":"0.0214"},
{"price":"2.100","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"2.200","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"2.300","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"2.400","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"2.500","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"2.600","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"2.700","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"2.800","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"2.900","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"3.000","longCountPercent":"0.0000","shortCountPercent":"0.0142"},
{"price":"3.100","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"3.200","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"3.300","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"3.400","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"3.500","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"3.600","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"3.700","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"3.800","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"3.900","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"4.000","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"4.100","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"4.200","longCountPercent":"0.0000","shortCountPercent":"0.0071"},
{"price":"4.300","longCountPercent":"0.0000","shortCountPercent":"0.0071"}
}```
It looks like the enpoint that is used to fetch the orderbooks wasn't set up correctly to have an API call auto-generated for it. I'll get that added and published shortly. The API call will indeed be "api.instrument.orderBook()" as you had predicted.
actually, since it's python, the API call will be order_book()
@dmpettyp the code is littered with camelCase... hence I was following that convention. I have a PR that solves the problem for me - should I submit it?
PR https://github.com/oanda/v20-python/pull/30 created
Hmm, while there is camel case in the code, I believe that it mostly is used to access data from the JSON responses, which is all camel case. I think that most of the python variables and function names use snake case.
Thanks for the PR, however all of the code in the library is auto-generated and we're not set-up to merge code into the library. You should be able to find the order_book() call is in the latest build.
https://github.com/oanda/v20-python/blob/master/src/v20/instrument.py#L932
Sweet! :thumbsup:
PS: you should also do this for position_book()
Can someone explain to me please, what does shortCountPercent and longCountPercent mean? how can I interpret this information?
The percentage of standing orders to sell and buy (respectively) at price points within the corresponding price bucket. The bucket’s lower bound is the price given and its upper bound is the price plus the bucket width, not inclusive, if I recall correctly.On Jan 22, 2023, at 1:16 PM, Santiago Ruiz Zuluaga @.***> wrote: Can someone explain to me please, what does shortCountPercent and longCountPercent mean? how can I interpret this information?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>
http://developer.oanda.com/rest-live-v20/instrument-ep/ refers an orderBook action, but this is not available in v20
I get this error:
Is this a bug?