forked from xeroc/stakemachine
-
Notifications
You must be signed in to change notification settings - Fork 131
Closed
Labels
[2] Advanced IssueIssue is a technically advanced or complex task. Requires prior knowledgeIssue is a technically advanced or complex task. Requires prior knowledge[3] Type: Bugcomponent: Staggered Orders
Description
From bitshares/python-bitshares#227 (comment)
In dexbot we're incrementing prices to place staggered orders, this is a test which shows actual order price and initially calculated price are different:
closer_order = worker.place_closer_order(asset, order, place_order=True)
# Test for correct price
> assert closer_order['price'] == order['price'] * (1 + worker.increment)
E assert 99.01980296969697 == 99.0099009894
E -99.01980296969697
E +99.0099009894
So, we should switch from incrementing prices to incrementing amount only (base or quote) to place staggered orders, and as a consequence we need a method to place orders specifying both base and quote amounts (see the first message)
Another example: test setup failed to place initial orders to close the target spread, see that 1% error:
_______________________________________________________ test_maintain_strategy[mountain-config0] ________________________________________________________
initial_allocation = {}
def test_maintain_strategy(initial_allocation):
""" Check if intial orders placement is correct
"""
worker = initial_allocation
# Check target spread is reached
> assert worker.actual_spread < worker.target_spread + worker.increment
E assert 0.030186976828429968 < (0.02 + 0.01)
E + where 0.030186976828429968 = {}.actual_spread
E + and 0.02 = {}.target_spread
E + and 0.01 = {}.increment
Metadata
Metadata
Assignees
Labels
[2] Advanced IssueIssue is a technically advanced or complex task. Requires prior knowledgeIssue is a technically advanced or complex task. Requires prior knowledge[3] Type: Bugcomponent: Staggered Orders