-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path21_01_12 FearnGreed Viewer.py
52 lines (42 loc) · 1.39 KB
/
21_01_12 FearnGreed Viewer.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/python
from pandas_datareader import data as pdr
import yfinance as yf
import matplotlib.pyplot as plt
from datetime import date
from dateutil.relativedelta import relativedelta
import pandas as pd
import numpy as np
import os, sys
import time
import os
from os import makedirs
import shutil
from currency_converter import CurrencyConverter
import quandl as ql
import datetime
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import quandl as ql
from datetime import date
import time
import datetime
import yfinance as yf
%matplotlib widget
%matplotlib inline
import pandas as pd
filename = "C:/*************************/Fear_and_Greed.csv"
# df = pd.read_csv(filename, sep='\t', encoding = 'utf-16',nrows=10, index_col="CASE")
df = pd.read_csv(filename, sep=',')
df.columns = ['UNIX', 'Jahr', 'Monat', 'Tag','UHrzeit', 'FnG']
fig, ax1 = plt.subplots(figsize=(20,12))
ax1.grid(color='black', linestyle='--', linewidth=0.05)
color = 'tab:red'
ax1.set_xlabel('date')
ax1.set_ylabel('Fear and Greed', color=color)
ax1.plot(pd.to_datetime(df['UNIX'],unit='s'), df.FnG, label='FnG', color=color)
ax1.tick_params(axis='y', labelcolor=color)
ax1.axhspan(0, 10, alpha=0.3, color='#fb9898')
ax1.axhspan(100, 90, alpha=0.3, color='#6a5acd')
ax1.set_ylim([0, 100])
fig.tight_layout() # otherwise the right y-label is slightly clipped