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

NFT-765: Market updates twitter bot #395

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

adamgobes
Copy link
Contributor

No description provided.

@linear
Copy link

linear bot commented Feb 23, 2023

@vercel
Copy link

vercel bot commented Feb 23, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
v2-interface ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 24, 2023 at 7:02PM (UTC)

@render
Copy link

render bot commented Feb 23, 2023

@@ -138,87 +137,3 @@ export function useControllerPricesData(): ControllerPricesDataReturn {
error: null,
};
}

function targets(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved this into its own helper file

* On one swap there was a tremendous market price which ruins the chart.
* Let's filter that one out.
*/
const OUTLIER_TIMESTAMP = 1675965383;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cnasc is this still needed? think we used a % based now?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can get rid of this, we do throw out values that we judge are "too high"

) {
const now = Math.floor(Date.now() / 1000);

const sortedSwaps = [...swaps].sort(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not related, but seems we should be able to sort in the swap query itself? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point

const underlyingDecimals = await erc20Contract(
configs[token].underlyingAddress,
token,
).decimals();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

easier to get this from the subgraph and save RPC calls? 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you make a graphql below so could combine

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, think its more readable to do this than entire graphQL call, we're on the server and tweeting every hour so performance less important?

url: configs[token].paprSubgraph,
});
const res = await graphQLClient
.query<TargetUpdatesByControllerQuery>(TargetUpdatesByControllerDocument, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could possibly optimize by having a query that only fetches the most recent target? or just do an RPC call for target and newTarget?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or if you want an accurate change over the last hour you had mentioned two RPC calls and passing in block height from an hour ago

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

roger

if (poolYesterdayRes.error) {
throw new Error(poolYesterdayRes.error.message);
}
const volumeUSDYesterday = poolYesterdayRes.data?.pool?.volumeUSD || 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cnasc did we find that this is not accurate and we had to sum the hourly?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We looked at summing the hourly data, but the fields came up as 0. My understanding is that this method is correct

@wilsoncusack
Copy link
Contributor

@adamgobes reminder I think we decided I think this can go in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants