CSIT 6000Q Assignment 3
CSIT 6000Q Assignment 3
Assignment 3
Problem 1 40 points
Write test cases for all smart contracts you designed in the last assignment
(Assignment 2). And verify them for vulnerabilities using any verification tool.
Also, verify with etherscan after successful deployment in your testnet.
Problem 3 30 points
Implement a basic trading strategy using a 3-day and 7-day simple moving av-
erage (SMA) on Ethereum’s daily price data for the past 150 days. Plot the
Ethereum price along with the 3-day and 7-day moving averages and mark the
buy and sell signals.
1
Details and Steps
1. Fetch Ethereum Price Data:
Using the provided Python script, retrieve the Ethereum price data for
the last 150 days.
1 import requests
2 import pandas as pd
3
17 # Save to CSV
18 df . to_csv ( " ethereum_data . csv " , index = False )
19 print ( " Data ␣ fetched ␣ and ␣ saved ␣ as ␣ ethereum_data . csv " )
20
You can implement this part either in Python (simpler, using the Pandas
library) or in SQL if you so choose.
If you choose to implement this in SQL, here is a Python function where
you can pass your SQL query as a parameter to execute it:
2
1 import sqlite3
2 import pandas as pd
3
3
Your output should look something like this:
4. Describe Observations:
• Briefly summarize what you observe from the visualization: Do the
buy/sell signals align with the price trends?
Submission
You must submit your answer as a Jupyter Notebook file (with .ipynb exten-
sion). Below are instructions on how to set up Python and Jupyter Notebook
locally or run your notebook in Google Colab.
4
3. Start Jupyter Notebook:
• Navigate to the folder where you want to save your notebook.
• In the command prompt or terminal, run:
jupyter notebook