Beispiel #1
0
# coding: utf-8

# In[ ]:

from BitcoinAverager import TimeUtil, BitcoinAverager, PriceCompositor, Forex, BitcoinDataLoader


# In[ ]:

all_exchanges = ['bitfinexUSD','bitstampUSD','itbitUSD',
                 'itbitEUR','krakenEUR','itbitSGD','anxhkHKD',
                 'okcoinCNY', 'btcnCNY']
compositor = PriceCompositor(all_exchanges)
compositor.reload()


# In[ ]:

from datetime import datetime
from dateutil.relativedelta import relativedelta
import pytz
hkg_time = pytz.timezone("Asia/Hong_Kong")
start_time = hkg_time.localize(datetime(2015,1,1,6,0,0))
period = relativedelta(minutes=1)
intervals = 60 * 24*90
compositor = PriceCompositor(['bitfinexUSD'], base_currency='USD')
data = compositor.composite_table(start_time, period, intervals)
data

Beispiel #2
0
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>

# <codecell>

from BitcoinAverager import TimeUtil, BitcoinAverager, PriceCompositor, Forex, BitcoinDataLoader

# <codecell>

all_exchanges = ['bitfinexUSD','bitstampUSD','itbitUSD',
                 'itbitEUR','krakenEUR','itbitSGD','anxhkHKD',
                 'okcoinCNY', 'btcnCNY']
compositor = PriceCompositor(all_exchanges)
compositor.reload()

# <codecell>

from datetime import datetime
from dateutil.relativedelta import relativedelta
import pytz
hkg_time = pytz.timezone("Asia/Hong_Kong")
start_time = hkg_time.localize(datetime(2015,1,1,6,0,0))
period = relativedelta(minutes=1)
intervals = 60 * 24*90
compositor = PriceCompositor(['bitfinexUSD'], base_currency='USD')
data = compositor.composite_table(start_time, period, intervals)
data

# <codecell>

averagers = {}
Beispiel #3
0
selected.plot(y="volume")

# <codecell>

import datetime
import time
import pytz
from dateutil.relativedelta import relativedelta
hkg_time = pytz.timezone("Asia/Hong_Kong")
start = hkg_time.localize(datetime.datetime(2014,2,1,6,0,0))
period = relativedelta(days=1)
intervals = 30

forex_list = ["GBPUSD"]
forex_table = {}
compositor = PriceCompositor()
avg = compositor.exchange_table(start, period, intervals)

for f in forex_list:
    forex = Forex(f)
    forex_table[f] = forex.rates(list(map(TimeUtil.unix_epoch, avg.index)), avg.index)
    forex_table[f].rename(columns={"rates" : f}, inplace=True)

avg = avg.join(forex_table[f] for f in forex_list)

# <codecell>

forex_table["GBPUSD"]

# <codecell>
Beispiel #4
0
def reload():
    compositor = PriceCompositor()
    compositor.reload()
    return "reloaded"
Beispiel #5
0
def reload():
    compositor = PriceCompositor()
    compositor.reload()
    return "reloaded"
Beispiel #6
0
import getpass

me = getpass.getuser()
sys.path.append(
    os.path.join("/home", me, "git/bitquant/web/home/ipython/examples"))
script_dir = os.path.dirname(os.path.realpath(__file__))
os.chdir(script_dir)

from BitcoinAverager import PriceCompositor

app = Flask(__name__)
all_exchanges = [
    'bitfinexUSD', 'bitstampUSD', 'itbitUSD', 'itbitEUR', 'krakenEUR',
    'itbitSGD', 'anxhkHKD', 'okcoinCNY', 'btcnCNY'
]
compositor = PriceCompositor(all_exchanges)


@app.route('/')
def index():
    return 'index'


@app.route('/average-form')
def average_form():
    retval = """
<form method=POST action="generate-data">
Start time (yyyy/mm/dd): <input name="year" size=4 value="2014">/
<input name="month" size=2 value="02">/<input name="day" size=2 value="01">  <input name="hour" size=2 value="00">:<input name="minute" size=2 value="00">:<input name="second" size=2 value="00"><br>
Time zone: <input name="tz" size=20 value="Europe/London"><br>
Time interval: <input name=interval_length value="3" size=3>
selected.plot(y="volume")

# <codecell>

import datetime
import time
import pytz
from dateutil.relativedelta import relativedelta
hkg_time = pytz.timezone("Asia/Hong_Kong")
start = hkg_time.localize(datetime.datetime(2014,2,1,6,0,0))
period = relativedelta(days=1)
intervals = 30

forex_list = ["GBPUSD"]
forex_table = {}
compositor = PriceCompositor()
avg = compositor.exchange_table(start, period, intervals)

for f in forex_list:
    forex = Forex(f)
    forex_table[f] = forex.rates(map(TimeUtil.unix_epoch, avg.index), avg.index)
    forex_table[f].rename(columns={"rates" : f}, inplace=True)

avg = avg.join(forex_table[f] for f in forex_list)

# <codecell>

forex_table["GBPUSD"]

# <codecell>