Skip to content

Commit

Permalink
Merge pull request #114 from Polygant/OC-174-default-pair-settings
Browse files Browse the repository at this point in the history
OC-174: default pairs precisions
  • Loading branch information
0lEV authored Apr 26, 2023
2 parents 8acfed5 + beef58e commit a8e66be
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
14 changes: 4 additions & 10 deletions core/migrations/0011_auto_20230413_0836.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,10 @@ def transfer_precisions(apps, schema_editor):
'BNB-USDT': ['100', '10', '1', '0.1', '0.01'],
'TRX-USDT': ['0.01', '0.001', '0.0001', '0.00001', '0.000001'],
}
for pair, precisions in precisions_map.items():
pair, created = PairSettings.objects.get_or_create(
pair=pair,
defaults={
'precisions': precisions
}
)
if not created:
pair.precisions = precisions
pair.save()
for ps in PairSettings.objects.all():
if ps.pair.code in precisions_map:
ps.precisions = precisions_map[ps.pair.code]
ps.save()


def reverse(a, s):
Expand Down
12 changes: 8 additions & 4 deletions wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,8 @@ def get_or_create(model_inst, curr, get_attrs, set_attrs: dict):
'is_autoorders_enabled': True,
'price_source': PairSettings.PRICE_SOURCE_EXTERNAL,
'custom_price': 0,
'deviation': 0.99000000
'deviation': 0.99000000,
'precisions': ['100', '10', '1', '0.1', '0.01']
},
BotConfig: {
'name': 'BTC-USDT',
Expand All @@ -491,7 +492,8 @@ def get_or_create(model_inst, curr, get_attrs, set_attrs: dict):
'is_autoorders_enabled': True,
'price_source': PairSettings.PRICE_SOURCE_EXTERNAL,
'custom_price': 0,
'deviation': 0.99000000
'deviation': 0.99000000,
'precisions': ['100', '10', '1', '0.1', '0.01']
},
BotConfig: {
'name': 'ETH-USDT',
Expand All @@ -517,7 +519,8 @@ def get_or_create(model_inst, curr, get_attrs, set_attrs: dict):
'is_autoorders_enabled': True,
'price_source': PairSettings.PRICE_SOURCE_EXTERNAL,
'custom_price': 0,
'deviation': 0.0
'deviation': 0.0,
'precisions': ['0.01', '0.001', '0.0001', '0.00001', '0.000001']
},
BotConfig: {
'name': 'TRX-USDT',
Expand All @@ -543,7 +546,8 @@ def get_or_create(model_inst, curr, get_attrs, set_attrs: dict):
'is_autoorders_enabled': True,
'price_source': PairSettings.PRICE_SOURCE_EXTERNAL,
'custom_price': 0,
'deviation': 0.0
'deviation': 0.0,
'precisions': ['100', '10', '1', '0.1', '0.01'],
},
BotConfig: {
'name': 'BNB-USDT',
Expand Down

0 comments on commit a8e66be

Please sign in to comment.