Git Product home page Git Product logo

Comments (5)

hootnot avatar hootnot commented on June 2, 2024

Error on parsing TRADE_DATA ? Be specific please.

Examples will be extended the next weeks.

Please take a look at the specs OANDA has on developer.oanda.com.
All endpoints are well documented. I've implemented them in the same groups: orders, trades, positions etc. Parameters, data ... it is all in the specs.

To close a trade: http://developer.oanda.com/rest-live-v20/trades-ep/. The tradeID is the ID you got as feedback from the other example. Pass the data body and done.

If you would like to close half of the position opened with the other example you could do:

cfg = { "units": 50 }
r = trades.TradeClose(accountID, tradeID=tradeID, data=cfg)
rv = api.request(r)
print("== IV (reduce)  ===================\nRESP: {} ".format(json.dumps(r.response, indent=4)))

(but markets are closed)

Other endpoints

r = trades.TradeDetails(accountID, tradeID)  
r = trades.TradesList(accountID)
r = trades.OpenTrades(accountID)
r = trades.TradeClientExtensions(accountID, tradeID, data=...)

from oanda-api-v20.

WestonShakespear avatar WestonShakespear commented on June 2, 2024

Okay thank you. I was reading the documentation on http://oanda-api-v20.readthedocs.io/en/latest/oanda-api-v20.html which I assumed went with this package and when executing the first example

# get a list of trades
from oandapyV20 import API
import oandapyV20.endpoints.trades as trades

api = API(access_token="xxx")
accountID = "101-305-3091856-001"

r = trades.Trades(accountID, op=trades.TRADE_LIST)
# show the endpoint as it is constructed for this call
print("REQUEST:{}".format(r))
rv = api.request(r)
print("RESPONSE:\n{}".format(json.dumps(rv, indent=2)))`

I was getting the error
`Traceback (most recent call last):
  File "test.py", line 8, in <module>
    r = trades.Trades(accountID, op=trades.TRADE_LIST)
AttributeError: 'module' object has no attribute 'TRADE_LIST'

Which led me to believe that the documentation was outdated for I looked through your code and could not find any TRADE_LIST

from oanda-api-v20.

WestonShakespear avatar WestonShakespear commented on June 2, 2024

Thank you for the link to the endpoints. I must have overlooked that at some point.

from oanda-api-v20.

hootnot avatar hootnot commented on June 2, 2024

Hi,

this piece is outdated. It is based on the first design. As of PR #4 I've
changed the design.
The example under the examples-menu reflect the current situation.

I will fix the outdated piece.

Thx

2016-10-22 0:42 GMT+02:00 WestonShakespear [email protected]:

Okay thank you. I was reading the documentation on http://oanda-api-v20.
readthedocs.io/en/latest/oanda-api-v20.html which I assumed went with
this package and when executing the first example
`# get a list of trades
from oandapyV20 import API
import oandapyV20.endpoints.trades as trades

api = API(access_token="xxx")
accountID = "101-305-3091856-001"

r = trades.Trades(accountID, op=trades.TRADE_LIST)
show the endpoint as it is constructed for this call

print("REQUEST:{}".format(r))
rv = api.request(r)
print("RESPONSE:\n{}".format(json.dumps(rv, indent=2)))`

I was getting the error
Traceback (most recent call last):
File "test.py", line 8, in
r = trades.Trades(accountID, op=trades.TRADE_LIST)
AttributeError: 'module' object has no attribute 'TRADE_LIST'

Which led me to believe that the documentation was outdated for I looked
through your code and could not find any TRADE_LIST


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#26 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIQ6bRDKuKjjUs-WS7GdR7F_0Fd6nyyAks5q2T_bgaJpZM4KdouJ
.

Feite Brekeveld

feitebrekeveld https://nl.linkedin.com/in/feitebrekeveld
@feite_brekeveld https://twitter.com/feite_brekeveld
github https://github.com/hootnot

from oanda-api-v20.

WestonShakespear avatar WestonShakespear commented on June 2, 2024

Thank you

from oanda-api-v20.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.