[Python SDK] <how to swap tokens in one wallet?> #104
-
EnvironmentMainnet Acknowledgement
Issue DescriptionI have encountered problems on Swap Token. There are two Orders in the document. Expected BehaviorI can swap token in one order in one wallet
Code Example
Repo Link (Optional)No response |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 1 reply
-
@uF4No @MexicanAce plz experts,I really need help.I have waited over a week,I have asked for help in dc and zigzag telegram,but noone answered |
Beta Was this translation helpful? Give feedback.
-
Atomic swap provides token swap within a single account. orderA = await wallet.get_order('USDT', 'ETH', Fraction(1500, 1), RatioType.token, Decimal('10.0'))
orderB = await wallet.get_order('ETH', 'USDT', Fraction(1, 1200), RatioType.token, Decimal('0.007'))
swap = await wallet.swap((orderA, orderB), 'ETH') Pay attention to following limitations (docs):
|
Beta Was this translation helpful? Give feedback.
Atomic swap provides token swap within a single account.
Pay attention to following limitations (docs):
orderA
specifiestokenA -> tokenB
, thenorderB
should specifytokenB -> tokenA
1/orderB.ratio <= orderA.amount/orderB.amount <= orderA.ratio