alpacahq / alpaca-trade-api-python

Python client for Alpaca's trade API
https://pypi.org/project/alpaca-trade-api/
Apache License 2.0
1.73k stars 534 forks source link

[Bug]: martingale : self.last_price rounding issue #697

Open malaka-kahingalage opened 1 year ago

malaka-kahingalage commented 1 year ago

Is there an existing issue for this?

Current Behavior

i have seen rounding issues in the self.last_price, which generates the below error.

invalid limit_price 106.215. sub-penny increment does not fulfil minimum pricing criteria

managed to fix this by adding the below before the buy and sell self.last_price = round(self.last_price, 2)

Expected Behavior

No response

SDK Version I encountered this issue in

martingale.py example

Steps To Reproduce

running the example and randomly generating the below error

`invalid limit_price 106.215. sub-penny increment does not fulfil minimum pricing criteria`

Filled out the Steps to Reproduce section?

Anything else?

No response