Bohr1005 / xcrypto

quant,trading system,crypto,async
MIT License
212 stars 57 forks source link

浮点数精度问题与传参 #6

Closed 10ucapital closed 4 days ago

10ucapital commented 6 days ago

实践中出现了浮点数转换精度问题,应该是出现在pyalgo/subscription.rs中的round_price和floor_to_lot_size函数中。简单改了一下,pyo3传decimal好像并不原生支持。

Order { time: 1719646291875, symbol: "ethfdusd", side: BUY, state: REJECTED, order_type: LIMIT, tif: GTC, quantity: 0.0058000000000000005, price: 3397.52, order_id: -1, internal_id: 51, trade_time: 0, trade_price: 0.0, trade_quantity: 0.0, acc: 0.0, making: false, }

10ucapital commented 5 days ago

好像我在传入rust那边改掉就好了。

Bohr1005 commented 4 days ago

可以提个pr吗,我合并一下你的代码

Bohr1005 commented 4 days ago

可以提个pr吗,我合并一下你的代码

Bohr1005 commented 4 days ago

已经提交最新的代码到main分支,目测应该是解决了精度问题

10ucapital commented 4 days ago

大佬动作还是快 thx