-
Notifications
You must be signed in to change notification settings - Fork 14
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
EthTracker notif settings implemented #33
Conversation
File: src/sample_showrunners/bank/bankChannel.ts
File: src/sample_showrunners/ethTicker/ethTickerChannel.ts
File: src/sample_showrunners/ethTicker/ethTickerKeys.json
File: src/sample_showrunners/ethTicker/ethTickerModel.ts
File: src/sample_showrunners/ethTicker/ethTickerSettings.json
All looks good. |
|
||
// 1. Store prev price in MongoDB | ||
// Store | ||
await ethTickerModel.findByIdAndUpdate( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can skip storing of % change if we directly get the data for 6h(current cron job) from the CMC API, I just checked it and it can be done.
}[timestamp: ${Math.floor(Date.now() / 1000)}]`; | ||
|
||
const payload = { | ||
type: 1, // Type of Notification |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type will be 3 here as we are sending Targetted notifications at line 54.
@@ -0,0 +1,8 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove Private key values
@@ -0,0 +1,17 @@ | |||
/* eslint-disable prettier/prettier */ | |||
import { model, Schema } from 'mongoose'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file won't be needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do the necessary changes, other things looks good.
File: src/sample_showrunners/bank/bankChannel.ts
Overall, the code seems to be correct with these minor issues. File: src/sample_showrunners/ethTicker/ethTickerChannel.ts
File: src/sample_showrunners/ethTicker/ethTickerJobs.ts
Other files:
Overall, the code seems to be correct with these minor issues. All looks good. |
const formattedPrice = Number(Number(price).toFixed(2)).toLocaleString(); | ||
|
||
|
||
const hourChange = Number(data.quote.USD.percent_change_1h); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you need to fetch the price percent change in 6 hour and then on the basis of that change, we will send notification.
please refer this : https://coinmarketcap.com/api/documentation/v1/#operation/getV3CryptocurrencyQuotesHistorical [Interval Options section].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick update.
let recipients: string[] = []; | ||
|
||
// 2. Get the list of all the addresses opted in for the setting - /subscribers?category=2&setting=true | ||
const { data: userData } = await axios(`https://backend-staging.epns.io/apis/v1/channels/eip155:${'11155111'}:${'0x9C2dA92ff312b630B67cEa1d2C234250c2d3410e'}/subscribers?category=${'2'}&setting=${'true'}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SDK has incorporated this API. So you can replace this with the SDK call
Closing this as btc tracker already exists |
This includes EthTicker channel with notif settings implemented that is triggered after a specific 1h percent change in Eth price.
Closes #32