Skip to content

Commit a477227

Browse files
committed
docs: added warning about trading illiquid pools/routes
1 parent 6e7529a commit a477227

1 file changed

Lines changed: 19 additions & 11 deletions

File tree

‎docs/getting-started.rst‎

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ Quoting prices
7676

7777
.. note::
7878

79-
These methods assume a certain route for the swap to take, which may not be the optimal route. See :issue:`69` for details.
79+
These methods assume a certain route for the swap to take, which may not be the optimal route. See :issue:`93` for details.
8080

8181
There are two functions to retrieve the price for a given pair, one for specifying how much you get given a certain amount of the input token, and another for specifying how much you need to pay to receive a certain amount of the output token.
8282

8383
:func:`~uniswap.Uniswap.get_price_input`
8484
````````````````````````````````````````
8585

86-
Returns the cost of the given number of input tokens, priced in the output token.
86+
Returns the amount of output tokens you get for a given amount of input tokens.
8787

8888
.. code:: python
8989
@@ -120,26 +120,34 @@ Making trades
120120

121121
The same route assumptions and need for handling decimals apply here as those mentioned in the previous section.
122122

123+
.. warning::
124+
125+
Always check the expected price before executing a trade. It's important that you're using a pool with adequate liquidity, or else you may suffer significant losses! (see :issue:`198`)
126+
127+
Use the Uniswap version with the most liquidity for your route, and if using v3, make sure you set the ``fee`` parameter to use the best pool.
128+
123129
:func:`~uniswap.Uniswap.make_trade`
124130
```````````````````````````````````
125131

126132
.. code:: python
127133
128-
# Make a trade where the input qty being known parameters
129-
uniswap.make_trade(eth, bat, 1*10**18) # sell 1 ETH for however many BAT
130-
uniswap.make_trade(bat, eth, 1*10**18) # sell 1 BAT for however many ETH
131-
uniswap.make_trade(bat, dai, 1*10**18) # sell 1 BAT for however many DAI
132-
uniswap.make_trade(eth, bat, 1*10**18, "0x123...") # sell 1 ETH for however many BAT, and send the BAT to the provided address
134+
# Make a trade by specifying the quantity of the input token you wish to sell
135+
uniswap.make_trade(eth, bat, 1*10**18) # sell 1 ETH for BAT
136+
uniswap.make_trade(bat, eth, 1*10**18) # sell 1 BAT for ETH
137+
uniswap.make_trade(bat, dai, 1*10**18) # sell 1 BAT for DAI
138+
uniswap.make_trade(eth, bat, 1*10**18, "0x123...") # sell 1 ETH for BAT, and send the BAT to the provided address
139+
uniswap.make_trade(dai, usdc, 1*10**18, fee=500) # sell 1 DAI for USDC using the 0.05% fee pool (v3 only)
133140
134141
:func:`~uniswap.Uniswap.make_trade_output`
135142
``````````````````````````````````````````
136143

137144
.. code:: python
138145
139-
# Make a trade where the output qty is known, based on the input parameters
140-
uniswap.make_trade_output(eth, bat, 1*10**18) # buy however many ETH for 1 BAT
141-
uniswap.make_trade_output(bat, eth, 1*10**18) # buy however many BAT for 1 ETH
142-
uniswap.make_trade_output(bat, dai, 1*10**18, "0x123...") # buy however many BAT for 1 DAI, and send the BAT to the provided address
146+
# Make a trade by specifying the quantity of the output token you wish to buy
147+
uniswap.make_trade_output(eth, bat, 1*10**18) # buy ETH for 1 BAT
148+
uniswap.make_trade_output(bat, eth, 1*10**18) # buy BAT for 1 ETH
149+
uniswap.make_trade_output(bat, dai, 1*10**18, "0x123...") # buy BAT for 1 DAI, and send the BAT to the provided address
150+
uniswap.make_trade_output(dai, usdc, 1*10**8, fee=500) # buy USDC for 1 DAI using the 0.05% fee pool (v3 only)
143151
144152
145153
Pool Methods (v1 only)

0 commit comments

Comments
 (0)