Skip to content

Instantly share code, notes, and snippets.

@scheithauer
scheithauer / cp.R
Created March 17, 2022 10:26
CP 02
plot <- gapminder %>%
filter(year == 2007) %>%
ggplot() +
labs(
x = "GDP per Capita",
y = "Life Expectancy",
color = "Population in millions",
size = "Population in millions"
) +
theme_minimal()
@scheithauer
scheithauer / cp.R
Created March 17, 2022 10:24
cp - 1
#install.packages(c("tidyverse", "gapminder", "MetBrewer"))
library(tidyverse)
library(gapminder)
library(MetBrewer)
fig = (
go.Figure(
data = [
go.Candlestick(
x = df_klines['opentime'],
open = df_klines['open'],
high = df_klines['high'],
low = df_klines['low'],
close = df_klines['close']
)
klines = client.get_historical_klines("BNBBTC", Client.KLINE_INTERVAL_1HOUR, "1 day ago UTC")
df_klines = pd.DataFrame(klines)
df_klines.columns = ['opentime', 'open', 'high', 'low', 'close', 'volume', 'closetime', 'quoteassetvolume', 'numberoftrades', 'tbuybase', 'tbuyquote', '_']
df_klines
{'symbol': 'BNBBTC',
'priceChange': '0.00144900',
'priceChangePercent': '20.912',
'weightedAvgPrice': '0.00792562',
'prevClosePrice': '0.00692800',
'lastPrice': '0.00837800',
'lastQty': '0.38000000',
'bidPrice': '0.00837700',
'bidQty': '54.80400000',
'askPrice': '0.00837800',
ticker = client.get_ticker(symbol = "BNBBTC")
ticker
tickers = client.get_ticker()
pd.DataFrame(tickers)
{'mins': 5, 'price': '0.00835585'}
client.get_avg_price(symbol = "BNBBTC")
{'symbol': 'BNBBTC',
'status': 'TRADING',
'baseAsset': 'BNB',
'baseAssetPrecision': 8,
'quoteAsset': 'BTC',
'quotePrecision': 8,
'quoteAssetPrecision': 8,
'baseCommissionPrecision': 8,
'quoteCommissionPrecision': 8,
'orderTypes': ['LIMIT',