Skip to content

Instantly share code, notes, and snippets.

View xeco-labs-aws-ec2-task-definition-sample
{
"family": "",
"taskRoleArn": "",
"networkMode": "",
"containerDefinitions": [
{
"memory": 1024,
"cpu": 100,
"links": ["mysql"],
"portMappings": [
@hossein761
hossein761 / median.py
Last active May 31, 2018
Calculate Median
View median.py
median = high_low_dif_df['high_low_dif'].divide(pnd_df['low']).multiply(100).median()
@hossein761
hossein761 / swing_hist.py
Last active May 31, 2018
histogram of price swings
View swing_hist.py
high_low_dif = pnd_df['high'].sub(pnd_df['low'], axis=0)
high_low_dif_df = pd.DataFrame(high_low_dif_df['high_low_dif'].divide(pnd_df['low']).multiply(100), columns=['high_low_dif'])
high_low_dif_df.plot.hist(alpha=0.5)
@hossein761
hossein761 / datapoints_above_5000.py
Created May 30, 2018
datapoints with high volume
View datapoints_above_5000.py
pnd_df = candles_df.loc[candles_df['volume'] >= 5000]
pnd_volume = pnd_df['volume'].values
pnd_high = pnd_df['high'].values
pnd_low = pnd_df['low'].values
fig1 = plt.figure()
ax1 = fig1.add_subplot(111, projection='3d')
ax1.scatter(pnd_low, pnd_high, pnd_volume, s=4, cmap='viridis')
@hossein761
hossein761 / guassian_mixtures.py
Created May 30, 2018
Gaussian mixture models using Coinograph's candle data
View guassian_mixtures.py
# train the models
gmm = GMM(n_components=5).fit(candles_df[['low', 'high', 'volume']])
# get the lables
labels = gmm.predict(candles_df[['low', 'high', 'volume']])
# visualise the mixture components (clusters)
volume = candles_df['volume'].values
high = candles_df['high'].values
low = candles_df['low'].values
fig = plt.figure()
@hossein761
hossein761 / load_data_visualise.py
Last active May 30, 2018
Load csv data into pandas dataframes
View load_data_visualise.py
# load data
candles_df = pd.read_csv('bitfinex_btcusd_1h.csv', header=0)
# show scatter matrix
scatter_matrix(candles_df[['open', 'close', 'low', 'high', 'volume']], alpha=0.2, figsize=(6, 6), diagonal='kde')
@hossein761
hossein761 / btcusd-bitfinex-1h-sample.csv
Last active May 30, 2018
Sample Coinograph.io data dump on BTC/USD Bitfinex 1h candles
View btcusd-bitfinex-1h-sample.csv
name time exchange pair open high low close volume
candles_3600 1514293200000 bitfinex btcusd 14998 15245 14952 15087 3021.2485508300006
candles_3600 1514296800000 bitfinex btcusd 15086 15688 15086 15684 5267.858995190001
candles_3600 1514300400000 bitfinex btcusd 15686 15748 15415 15643 2747.9954799700017
candles_3600 1514304000000 bitfinex btcusd 15644 15950 15589 15908 3205.843680159999
candles_3600 1514307600000 bitfinex btcusd 15909 15909 15301 15650 2783.9943436099993
candles_3600 1514311200000 bitfinex btcusd 15650 15749 15414 15592 1668.26745245
candles_3600 1514314800000 bitfinex btcusd 15591 15841 15589 15787 1545.30452236
@hossein761
hossein761 / logback-test.xml
Created Nov 25, 2014
Example of logback configuration for Play Framework 2 for a test environment
View logback-test.xml
<configuration>
<conversionRule conversionWord="coloredLevel" converterClass="play.api.Logger$ColoredLevel" />
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>${application.home}/logs/application.log</file>
<encoder>
<pattern>%date - [%level] - from %logger in %thread %n%message%n%xException%n</pattern>
</encoder>
</appender>