Deploy a DataConsumerV3 to sepolia testnet and interact with javascript code to read the data and write to a json file.
Use python to interact with json file to anaylze data
In order to have the script work correctly you must configure your hardhat.config.js to interact with the sepolia testnet.
- Create an alchemy url endpoint for the Sepolia testnet
- Create .env file
- API_URL = newly created Alchemy Sepolia URL key string
- PRIVATE_KEY = wallet private key string (MAKE SURE TO use separate accounts: 1 for testing and another to store real money - if applicable)
Run the following cmd to ensure all dependencies are integrated into your project
npm installThe following script runs the deploy.js script that will deploy the DataConsumerV3 contract to the Sepolia Testnet
npx hardhat run scripts/deploy.js --network sepoliaCopy the outputed contract address and paste it into the addr variable in the interact.js file
The next cmd will call the newly created contract in order to get live data
node scripts/interact.jsTODO
- get historical data: https://docs.chain.link/data-feeds/historical-data
- round if from latestRoundData() roundID field?
- You can compare the data across these windows to infer whether the volatility of an asset is trending up or down. For example, if realized volatility for the 24-hour window is higher than the 7-day window, volatility might increase
- create model to train against historical data
- use these functions to get rates on real time stock market data ... somehow
- Use a trusted oracle source to give accurate stock price data (may not even work yet)
- calculate historical volatility of crypto assest/stock
You can read through the following documentation to learn more https://docs.chain.link/data-feeds