zetamarkets / zetamarkets-py

Zeta Python SDK
Apache License 2.0
32 stars 9 forks source link

Trade history? #5

Open jgustave opened 1 year ago

jgustave commented 1 year ago

I did a brief pass through the API, I didn't see a way to extract my historical trades. It helps to pay my taxes :)

0xtristan commented 11 months ago

Trades aren't stored historically on the blockchain since the program is stateless. If you want to log your own trades to your own database you can run the subscribe_transaction example (https://github.com/zetamarkets/zetamarkets-py/blob/master/examples/subscribe_transaction.py) and write trade events to your db.

Else if that's a hassle we do this for you, and the historical trades are available in the Zeta front-end in your trade history (we store it in a database on our end and expose it via API). At some point we're looking to add CSV export of trades to make users accounting easier. Lmk if any other qs.

ksajan commented 4 months ago

@0xtristan Hello is it possible to get this API exposed to fetch account historical information? Thank you!

filipzeta commented 4 months ago

@ksajan you can grab this via api.zeta.markets/v2/trades

eg: https://api.zeta.markets/v2/trades?marginAccount=cyP5aWMWtaVXMJBSpVPf9pBxd5xocTFN2Zx6TKjDF9E&fromTimestamp=1712501543&toTimestamp=1712940035&limit=15