-
Notifications
You must be signed in to change notification settings - Fork 0
/
historic_data.py
31 lines (26 loc) · 1 KB
/
historic_data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from Historic_Crypto import HistoricalData
from datetime import datetime
import yfinance as yf
import pandas as pd
import os
# Gets Crypto Asstet
def get_user_crypto():
user_input = input("\nPlease enter at Crypto ticker: ")
ticker = f'{user_input.upper()}-USD'
time = 86400 # currently looking at daily TF
Lookback_date = '2015-01-01-00-00'
new = HistoricalData(ticker,time,Lookback_date).retrieve_data()
pre_pross = pd.DataFrame(new)
return pre_pross, ticker
def get_user_forex():
today = datetime.today()
print("\nEURUSD GBPUSD USDJPY AUDUSD USDCAD\n")
user_input = input("\nPlease enter at Forex ticker: ")
ticker = f'{user_input.upper()}=x'
formatted_date = today.strftime('%Y-%m-%d')
forex_pair = ticker
user_input_year = input("\n Please enter a starting year (1900 for all time): ")
start_date = f"{user_input_year}-01-01"
end_date = formatted_date
pre_pross = yf.download(forex_pair, start=start_date, end=end_date)
return pre_pross, ticker