antonio-hickey / TradovatePy

Python wrapper for the Tradovate API
MIT License
30 stars 8 forks source link

documentation, how-to, samples and examples #2

Closed shobnaren closed 1 year ago

shobnaren commented 2 years ago

Can you please add samples

antonio-hickey commented 2 years ago

Sure, anything specific you'd like samples on?

shobnaren commented 2 years ago

start from login, order submission, order status, cancel order, open positions and close all open position, flip position (long to short, short to long) etc.

shobnaren commented 1 year ago

sample code: `import os import asyncio

from TradovatePy.models.session import Session from TradovatePy.accounting import Accounting

params = { "environment": os.getenv("TO_ENV"), "username": os.getenv("TO_USERID"), "password": os.getenv("TO_PASSWD"), "secret_key": os.getenv("TO_SECRET"), "device_id": os.getenv("TO_DEVID"), "app_version": os.getenv("TO_APPVER"), "app_id": os.getenv("TO_APPID"), "cid": os.getenv("TO_CID"), }

s = Session(**params) if True: a = Accounting(s) out = asyncio.run(a.account_list()) print(out)`

but this one - throws below error as providing the account_list response - https://bugs.python.org/issue36709 Is there any safe handling of it - is there sample further or better way of using code - please share.

grzesir commented 1 year ago

Can you please add a working example of how to connect to tradeovate, get your account balances/positions and place a trade?

antonio-hickey commented 1 year ago

@shobnaren

Sorry for wait this was just fixed: https://github.com/antonio-hickey/TradovatePy/commit/b589ad6633212a31fecc45ade537b0285f743464