Closed chuengchuenghq closed 6 years ago
Hi,
An example to get the last prices is in the README of oanda-api-v20: https://github.com/hootnot/oanda-api-v20#processing-series-of-requests
See the pricing endpoints and readthedocs for details.... and of course the developer.oanda.com docs.
So:
import json
from oandapyV20 import API # the client
from oandapyV20.exceptions import V20Error
import oandapyV20.endpoints.pricing as pricing
access_token = "..."
accountID = "..."
client = API(access_token=access_token)
# request pricing info
params={"instruments": "DE30_EUR,EUR_GBP"}
r = pricing.PricingInfo(accountID, params=params)
rv = client.request(r)
print(rv)
Feite
Hi,what you said is the latest ask/bid price ,not the latest deal price in the foreign exchange.
@chuengchuenghq , that specific part "latest deal price", was not in the question. I'm afraid you can't get that data.
The one I gave you lets you retrieve the last prices for a number of instruments. The other option is streaming prices: bids / asks and liquidity. And there is the posibility for historical candles with a specified granularity.
Last deal price is 'history' so for trading only last bid/ask is relevant. But I guess you have your reasons.
thank you very much. I will try other way to see if i can get that data.
note: since Forex is OTC last price done is bound to the broker where you get your prices. It is possible that at the same time at another broker the same pair is done at a different price, or that your broker does less transactions than another. It is not a central market so you will only get a part of the picture
Hello,I would like to know how to get the latest price in OANDA-V20 API? My market data application need to display the latest price on the screen, thanks in advance.