This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from ouimeaux.environment import Environment | |
| def on_switch(switch): print switch.name | |
| env = Environment(on_switch, on_switch) | |
| env.start() | |
| print env.discover() | |
| print env.list_switches() | |
| switch = env.get_switch('Aeroponics plug') | |
| print "State->", switch.get_state() | |
| switch.on() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CONTRACT ADDRESS: 0x6B365Fe592881E916dc77Ef410e5f9CE4654369A | |
| JSON INTERFACE: [ { "constant": true, "inputs": [], "name": "name", "outputs": [ { "name": "", "type": "string", "value": "HugCoin" } ], "type": "function" }, { "constant": true, "inputs": [], "name": "totalHuggers", "outputs": [ { "name": "", "type": "uint256", "value": "1" } ], "type": "function" }, { "constant": true, "inputs": [ { "name": "", "type": "address" } ], "name": "balanceOf", "outputs": [ { "name": "", "type": "uint256", "value": "0" } ], "type": "function" }, { "constant": false, "inputs": [ { "name": "receipient_name", "type": "string" }, { "name": "_to", "type": "address" } ], "name": "giveHugTo", "outputs": [ { "name": "success", "type": "bool" } ], "type": "function" }, { "constant": false, "inputs": [], "name": "destroy", "outputs": [], "type": "function" }, { "constant": true, "inputs": [], "name": "symbol", "outputs": [ { "name": "", "type": "string", "value": "🤗" } ], "type": "function" }, { "constant": false, "inputs": [ { "n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Import numpy as np | |
| from sklearn.cluster import MeanShift, estimate_bandwidth | |
| data = open('f.csv', 'r').read().splitlines() | |
| x = np.asarray(map(lambda x: float(x.split(',')[2]), data)) | |
| X = np.array(zip(x,np.zeros(len(x))), dtype=np.float) | |
| bandwidth = estimate_bandwidth(X, quantile=0.1) | |
| ms = MeanShift(bandwidth=bandwidth, bin_seeding=True) | |
| ms.fit(X) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def run_algo(data): | |
| row_iterator = data.iterrows() | |
| (i, previous_price) = row_iterator.next() | |
| for (timestamp, current_price) in row_iterator: | |
| if not in_trade and (previous_price['Buy']['high'] - previous_price['Buy']['low'] > pips(strategy_data['pips_to_trigger'])): | |
| # Triggered | |
| # place a sell order, a TP and a SL | |
| add_order(order_book, timestamp, current_price['Sell']['open'], "SELL") | |
| in_trade = True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def main(strategy_file): | |
| order_book = [] | |
| strategy_data = read_strategy(strategy_file) | |
| # read csv files with daily data per second | |
| data = pandas.read_pickle("../Data/EUR_USD.csv-OHLC-1M.pkl") | |
| stats_days = run_algo(order_book, strategy_data, data) | |
| print_stats(stats_days) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def loop(config, oanda, strategy_data, last_price, in_trade): | |
| response = oanda.get_prices(instruments="EUR_USD") | |
| current_price = response.get("prices")[0].get("ask") | |
| log_trade(config, datetime.now(), current_price, "info") | |
| trade_id = None | |
| if not in_trade: | |
| if (last_price - current_price) > pips(strategy_data['pips_to_trigger']): | |
| in_trade = True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Creates db that contains the aggregated/calculated data of stocks | |
| Jon V (darksun4@gmail.com) | |
| 07/24/2014 | |
| """ | |
| import sys, os | |
| sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..")) | |
| import numpy as np |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| se agapaw k eisai to lakouvaki mou |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; Returns a list of tokenized elements | |
| (tokenizer #(.split % ":"))) | |
| ;; the mapping is done here | |
| (columns |time| |open| |high| |low| |close| |volume|) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (columns (define-field "ver" 0) | |
| (define-field "tag" 1) | |
| (define-field "phone-model" 2) | |
| (define-field "manufacturer" 3) | |
| (define-field "os-ver" 4) | |
| (define-field "app-ver" 5) | |
| (define-field "country" 6) | |
| (define-field "timestamp" 7) | |
| (define-field "uuid" 8) | |
| (tokenize (separator ":"))) |
NewerOlder