This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Licensed under the MIT License. See comment below for full licence information. | |
import requests | |
import json | |
bob = requests.get("https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=gbp", headers = {"accept":"application/json"}) | |
print("The price of bitcoin is currently £" + str(bob.json()["bitcoin"]["gbp"])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Licensed under the MIT License. See comment below for full license information. | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
plt.style.use("dark_background") | |
df = pd.read_csv("Kraken_BTCUSD_d.csv") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Licensed under the MIT License. See comment below for full license information. | |
import yfinance as yf | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
stock = yf.Ticker("KO") | |
print(stock.info['open']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Licensed under the MIT License. See comment below for full licence information. | |
def gridtraveller(m,n, dict = {}): | |
key = str(m) + "," + str(n) | |
if(m == 1 and n == 1): | |
return 1 | |
elif(m ==0 or n == 0): | |
return 0 | |
elif( key in dict.keys()): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Licensed under the MIT License. See comment below for full licence information. | |
import pandas as pd | |
import numpy as np | |
from scipy.optimize import curve_fit | |
import matplotlib.pyplot as plt | |
## data processing | |
df = pd.read_csv("data.csv") | |
df = df[ df['Value'] > 0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Licensed under the MIT License. See comment below for full licence information. | |
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import matplotlib.ticker as mtick | |
## data processing | |
df = pd.read_csv("data.csv") | |
df = df.iloc[::-1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Licensed under the MIT License. See comment below for full licence information. | |
import plotly.graph_objects as go | |
import pandas as pd | |
df = pd.read_csv("Kraken_BTCUSD_d.csv") | |
df = df.iloc[::-1] | |
df['date'] = pd.to_datetime(df['date']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Licensed under the MIT License. See comment below for full licence information. | |
import yfinance as yf | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
weightings1 = {"SPY":"100"} | |
weightings2 = {"SPY":"95","BTC-USD":"5"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Licensed under the MIT License. See comment below for full licence information. | |
from datetime import datetime | |
import backtrader as bt | |
class SmaCross(bt.SignalStrategy): | |
def __init__(self): | |
sma = bt.ind.SMA(period=50) | |
price = self.data | |
crossover = bt.ind.CrossOver(price, sma) |
OlderNewer