示例#1
0
from app import app
from app import server
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Input, Output
from datetime import datetime
import dash_table
import pandas as pd
from PriceIndices import MarketHistory, Indices
# import get_coin_data function from data.py
from data import get_coin_data

history = MarketHistory()

colors = {'background': '#111111', 'background2': '#FF0', 'text': 'yellow'}
coin_list = ['bitcoin', 'ethereum', 'ripple', 'bitcoin-cash']

tabs_styles = {'height': '51px'}
tab_style = {
    'borderBottom': '1px solid #d6d6d6',
    'padding': '2px',
    'fontWeight': 'bold'
}

tab_selected_style = {
    'borderTop': '1px solid #d6d6d6',
    'borderBottom': '1px solid #d6d6d6',
    'backgroundColor': 'black',
    'color': 'yellow',
    'padding': '10px'
}
示例#2
0
from PriceIndices import MarketHistory
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import pickle
import tensorflow as tf

config = tf.ConfigProto(intra_op_parallelism_threads=0,
                        inter_op_parallelism_threads=0,
                        allow_soft_placement=True)
session = tf.Session(config=config)
from sklearn.preprocessing import MinMaxScaler
from keras.models import Sequential
from keras.layers import Dense, Dropout, LSTM

price = MarketHistory()


def price_predict(coin, start_date, end_date):

    print('Your inputs are {0}, {1}, and {2}'.format(coin, start_date,
                                                     end_date))
    df = price.get_price(str(coin), str(start_date), str(end_date))

    df['date'] = pd.to_datetime(df['date'])

    df = df.sort_values(by='date')

    df = df.set_index(df['date'])[['price']]

    print('Price data of {0} days have been extracted.'.format(len(df)))
示例#3
0
文件: index.py 项目: ggoni/AppDS4A
from app import app
from app import server
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Input, Output
from datetime import datetime
import pandas as pd
from PriceIndices import MarketHistory, Indices
history = MarketHistory()
df = history.get_price('bitcoin', '20130428',
                       '20200510')  # Get Bitcoin price data
df['date'] = pd.to_datetime(df['date'])
colors = {'background': '#111111', 'background2': '#FF0', 'text': 'yellow'}

app.layout = html.Div(
    [
        html.H1('Bitcoin Price Graph',
                style={
                    'textAlign': 'center',
                    "background": "yellow"
                }),
        html.Div(
            [
                'Date selector for graphs.',  # add DateRangePicker here
                dcc.DatePickerRange(id='date-input',
                                    stay_open_on_select=False,
                                    min_date_allowed=datetime(2018, 1, 2),
                                    max_date_allowed=datetime(2019, 12, 31),
                                    initial_visible_month=datetime(
                                        2019, 6, 30),
                                    start_date=datetime(2019, 1, 2),