# Dataset contendo os registros diários
import pandas as pd
df = pd.read_csv("https://gist.githubusercontent.com/nucoinha/56c6565767600102bc80df7ae0c9bda7/raw/7bd712357afd51dd88eaa42466ef980d493f43d3/daily.csv")
df.describe()# Número de Wallets ao longo do tempo
import pandas as pd
import plotly.express as px
# Load the dataset
url = "https://gist.githubusercontent.com/nucoinha/56c6565767600102bc80df7ae0c9bda7/raw/7bd712357afd51dd88eaa42466ef980d493f43d3/daily.csv"
df = pd.read_csv(url)
# Drop rows where 'wallets' or 'date' are NaN
df = df.dropna(subset=['wallets', 'date'])
# Convert 'date' column to datetime format
df['date'] = pd.to_datetime(df['date'])
# Create the time series plot
fig = px.line(df, x='date', y='wallets',
title='Wallets Over Time',
labels={'date': 'Date', 'wallets': 'Wallets'})
# Show interactive plot
fig.show()# Gráfico de candles ao longo do tempo
import pandas as pd
import plotly.graph_objects as go
# Load the dataset
url = "https://gist.githubusercontent.com/nucoinha/56c6565767600102bc80df7ae0c9bda7/raw/7bd712357afd51dd88eaa42466ef980d493f43d3/daily.csv"
df = pd.read_csv(url)
# Drop rows where 'open', 'max', 'min', or 'close' are NaN
df = df.dropna(subset=['open', 'max', 'min', 'close'])
# Rename columns to fit OHLC format
df.rename(columns={'max': 'high', 'min': 'low'}, inplace=True)
# Convert 'date' column to datetime format and set it as the index
df['date'] = pd.to_datetime(df['date'])
df.set_index('date', inplace=True)
# Create OHLC Plot
fig = go.Figure(data=[go.Candlestick(
x=df.index,
open=df['open'],
high=df['high'],
low=df['low'],
close=df['close']
)])
# Update layout for better presentation
fig.update_layout(
title='OHLC Chart',
xaxis_title='Date',
yaxis_title='Price',
xaxis_rangeslider_visible=False, # Hide the range slider
xaxis_rangeslider=dict(visible=False)
)
# Show interactive plot
fig.show()import pandas as pd
import plotly.graph_objects as go
# Carregar o dataset
url = "https://gist.githubusercontent.com/nucoinha/56c6565767600102bc80df7ae0c9bda7/raw/7bd712357afd51dd88eaa42466ef980d493f43d3/daily.csv"
df = pd.read_csv(url)
# Remover linhas onde 'date' é NaN
df = df.dropna(subset=['date'])
# Converter 'date' para datetime
df['date'] = pd.to_datetime(df['date'])
# Criar o gráfico de linhas com eixos y secundários
fig = go.Figure()
# Adicionar linha para 'transactions' no eixo y terciário
fig.add_trace(go.Scatter(x=df['date'], y=df['transactions'], mode='lines+markers', name='Transactions', yaxis='y1'))
# Adicionar linha para 'volume' no eixo y quaternário
fig.add_trace(go.Scatter(x=df['date'], y=df['volume'], mode='lines+markers', name='Volume', yaxis='y2'))
# Atualizar layout para o gráfico
fig.update_layout(
title='Comparação de Séries Temporais - Transactions e Volume',
xaxis_title='Data',
yaxis_title='Transactions', # Título para o eixo y primário
yaxis2=dict(
title='Volume', # Título para o eixo y secundário
overlaying='y',
side='right'
),
legend_title='Variáveis',
xaxis_rangeslider_visible=False,
template='plotly_dark' # Escolha o tema que preferir
)
# Mostrar gráfico interativo
fig.show()import pandas as pd
import plotly.graph_objects as go
# Carregar os dados do último dia
url_latest = "https://gist.githubusercontent.com/nucoinha/56c6565767600102bc80df7ae0c9bda7/raw/b6c5230e4016a34bfffdd63ca8e24915406aad87/data_2024-09-10.csv"
df_latest = pd.read_csv(url_latest)
# Converter 'datetime' para datetime
df_latest['datetime'] = pd.to_datetime(df_latest['datetime'])
# Criar o gráfico de linhas
fig = go.Figure()
# Adicionar linha para o preço de abertura
fig.add_trace(go.Scatter(
x=df_latest['datetime'],
y=df_latest['open'],
mode='lines',
name='Preço de Abertura',
line=dict(color='blue')
))
# Adicionar linha para o preço de fechamento
fig.add_trace(go.Scatter(
x=df_latest['datetime'],
y=df_latest['close'],
mode='lines',
name='Preço de Fechamento',
line=dict(color='red')
))
# Adicionar linha para o volume como uma linha adicional
fig.add_trace(go.Scatter(
x=df_latest['datetime'],
y=df_latest['volume'],
mode='lines',
name='Volume',
line=dict(color='green'),
yaxis='y2'
))
# Atualizar layout para o gráfico
fig.update_layout(
title='Preços e Volume para 2024-09-10',
xaxis_title='Hora',
yaxis_title='Preço',
yaxis2=dict(
title='Volume',
overlaying='y',
side='right'
),
template='plotly_dark' # Escolha o tema que preferir
)
# Mostrar gráfico interativo
fig.show()