Skip to content

Commit 05f4a69

Browse files
committed
Fix 'not a string' error
1 parent c0cf069 commit 05f4a69

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

shipane_sdk/models.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ def from_json(json):
367367
order.style = OrderStyle(json['type'])
368368
order.price = json['price']
369369
order.amount = json['amount']
370+
order.amountProportion = json.get('amountProportion', '')
370371
return order
371372

372373
@staticmethod
@@ -377,7 +378,7 @@ def from_e_order(**kwargs):
377378
order.style = OrderStyle(kwargs['type'])
378379
order.price = kwargs['price']
379380
order.amount = kwargs.get('amount', 0)
380-
order.amountProportion = kwargs.get('amountProportion')
381+
order.amountProportion = kwargs.get('amountProportion', '')
381382
return order
382383

383384
def __init__(self, id=None, action=None, security=None, amount=None, amountProportion=None, price=None, style=None,
@@ -410,7 +411,7 @@ def to_e_order(self):
410411
priceType=(0 if self._style == OrderStyle.LIMIT else 4),
411412
price=self._price,
412413
amount=self._amount,
413-
amountProportion=self._amountProportion
414+
amountProportion=self._amountProportion or ''
414415
)
415416
return e_order
416417

0 commit comments

Comments
 (0)