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 pandas as pd | |
import time | |
from datetime import datetime,timedelta | |
apiUrl = "https://api.pro.coinbase.com" | |
sym = "ETH-USD" |
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 pandas as pd | |
import mplfinance as mpf | |
df = yf.Ticker("BTC-USD").history(period="max") | |
df["50ma"] = (df["Open"].rolling(window=50).mean() ) / 1.5 | |
df["ma"] = (df["Open"].rolling(window=50).mean() ) * 1.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. | |
import pandas as pd | |
import requests | |
r = requests.get("https://www.coingecko.com/en?page=2") | |
df = pd.read_html(r.text)[0] | |
df = df[["Coin","Price","Mkt Cap"]] |
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 matplotlib.pyplot as plt | |
from matplotlib import ticker | |
df = pd.read_csv("bitcoin-historical-price.csv")[["Date","Value"]] | |
df["Date"] = pd.to_datetime(df.Date) | |
plt.style.use("fivethirtyeight") |
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 matplotlib.pyplot as plt | |
import yfinance as yf | |
import ta | |
df = yf.Ticker("BTC-USD").history(period='max').reset_index()[["Date","Close"]] | |
plt.style.use("dark_background") |
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 requests import Request, Session | |
import json | |
import pprint | |
import time | |
url = 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest' | |
parameters = { | |
'slug':'bitcoin', |
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) |
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. | |
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 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] |