Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd1d4ee4

Browse files
committed
Added ability to monitor multiple tokens concurrently
1 parent9bb2b4c commitd1d4ee4

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

‎CHANGELOG.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- Project Setup:heavy_check_mark:
66
- Initial commit:heavy_check_mark:
77
- Add support for 1inch price aggregator:heavy_check_mark:
8-
- Add ability to monitor multiple tokens concurrently
8+
- Add ability to monitor multiple tokens concurrently:heavy_check_mark:
99
- Add ability to buy and sell tokens across various supported exchanges on different blockchains
1010
- Add support for ethereum blockchain:heavy_check_mark:
1111

‎src/index.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ const Main = async () => {
5959

6060
console.log(`---`.repeat(10));
6161

62-
letethAmount=newBigNumber(config.ETH_IN_AMOUNT).shiftedBy(18).toString()
62+
letethInAmount=newBigNumber(config.ETH_IN_AMOUNT).shiftedBy(18).toString()
6363
schedule(`*/${config.PRICE_CHECK_INTERVAL_IN_SECONDS} * * * * *`,asyncfunction(){
6464
console.log(`***`.repeat(10));
6565
MONITORED_TOKENS.forEach(async(token:any)=>{
6666
try{
6767
constbuy_quote:Quote=awaitoneInch.getQuote({
6868
srcToken:'0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
6969
toToken:token.address,
70-
srcAmount:ethAmount
70+
srcAmount:ethInAmount
7171
})
7272
lettoken_amount=buy_quote.toAmount
7373
constsell_quote:Quote=awaitoneInch.getQuote({
@@ -91,6 +91,7 @@ const Main = async () => {
9191
};
9292
consttimestamp=newDate()
9393
leteth_out=parseFloat(newBigNumber(sell_quote.toAmount).shiftedBy(-sell_quote.toToken.decimals).toFixed(6))
94+
9495
constprofit_pct=((eth_out-config.ETH_IN_AMOUNT)/config.ETH_IN_AMOUNT)*100
9596
lettoken_out=parseFloat(newBigNumber(token_amount).shiftedBy(-buy_quote.toToken.decimals).toFixed(6))
9697
letbest_buy_protocols=(awaitflat(buy_quote.protocols)).map((quote:any)=>quote.name).join(',')
@@ -107,7 +108,7 @@ const Main = async () => {
107108
rate:`${config.PRICE_CHECK_INTERVAL_IN_SECONDS}s`
108109
},
109110
]);
110-
if(!(JSON.stringify(best_buy_protocols)==JSON.stringify(best_sell_protocols))){
111+
if(JSON.stringify(best_buy_protocols)!=JSON.stringify(best_sell_protocols)){
111112
console.log(table);
112113
}
113114

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp