Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prices are sometimes wrong #3

Open
crypto456 opened this issue Aug 22, 2020 · 1 comment
Open

Prices are sometimes wrong #3

crypto456 opened this issue Aug 22, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@crypto456
Copy link

crypto456 commented Aug 22, 2020

I just installed it and ran:
$ yarn start ETH USDC
Every hour the prices are sometimes wrong... You can easily tell by the % change. It appears that it gives wrong output only when showing a complex, multi-swap transaction using 1inch.exchange or similar.

2 Feature Requests:

  1. Allow local IPC web3 connection
  2. Output block numbers by default on every price line. After the % change

Other than this price problem it works great 👍👍

Example when it's wrong:

$ yarn start ETH USDC

[2020-08-22 02:26:52] Sold 12.568529 ETH for 4810.996386 USDC (382.781 USDC / -0.06%)
[2020-08-22 02:26:52] Sold 7.967268 ETH for 3047.232091 USDC (382.469 USDC / -0.08%)
[2020-08-22 02:26:52] Sold 20 ETH for 7640.893426 USDC (382.045 USDC / -0.11%)
[2020-08-22 02:26:56] Sold 1.603707 ETH for 612.161733 USDC (381.717 USDC / -0.09%)
---> [2020-08-22 02:26:56] Bought 25.56931 ETH for 11679.712219 USDC (456.786 USDC / +19.67%)
---> [2020-08-22 02:27:20] Sold 2.3026 ETH for 897.637987 USDC (389.837 USDC / -14.66%)
[2020-08-22 02:27:45] Sold 2.042209 ETH for 799.178 USDC (391.330 USDC / +0.38%)
[2020-08-22 02:27:51] Bought 0.35326886 ETH for 135.427461 USDC (383.355 USDC / -2.04%)
[2020-08-22 02:27:51] Sold 3.531791 ETH for 1345.649935 USDC (381.011 USDC / -0.61%)

---> 25.56931 ETH: https://etherscan.io/tx/0x3251ff67be0408bcbd1afd53ef15f061270a33c328d9f1d1f258a1b2fee3e508/

uniswap.info's transaction table when I viewed the transaction live:
Swap ETH for USDC
total value: $9,750
token amount: 25.56931 ETH
token amount: 9,750 USDC

@stefanmendoza stefanmendoza added the bug Something isn't working label Aug 23, 2020
@stefanmendoza stefanmendoza self-assigned this Aug 23, 2020
@stefanmendoza
Copy link
Owner

Yeah, I've also noticed this. There's also the case where an arbitrage happens:

Swap 1 ETH for 1 LINK on Uniswap
Swap 1 LINK for 1 USDC on Balancer
Swap 1 USDC for 1 USDT on Balancer
Swap 1 USDT fo 1 LINK on Balancer
Swap 1 LINK for 1 ETH on Uniswap

in this case, we should consider both the initial buy and the final sell vs. just treating this as a buy as it'll throw off the next transaction.

I'm working on refactoring the code to make it more manageable then see if I can leverage the amounts in each reserve token to calculate the pricer more correctly. I need to dig more into Uniswap's documentation on how the midPrice and nextExecutionPrice are handled in V2.

Thanks for bringing this u!

Repository owner deleted a comment from jccalbuquerque Feb 14, 2024
Repository owner deleted a comment from BhavyClover Feb 22, 2024
Repository owner deleted a comment from Ikpong-Joseph Feb 23, 2024
Repository owner deleted a comment from Tejesh18 Feb 23, 2024
Repository owner deleted a comment from Sofia2933 Feb 23, 2024
Repository owner deleted a comment from tim-tepia Mar 18, 2024
@github-staff github-staff deleted a comment from mzm-alanfong Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants
@stefanmendoza @crypto456 and others