This file contains 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 dateparser | |
def detect_date(line=""): | |
"""Detect multiple, multi language date and datetime entries in a given string. | |
@param type: String to detect occuring_dates in, ideally a single line. | |
@type type: String | |
@return: Returns the list of found DateTime objects or None | |
@rtype: List or None | |
""" |
This file contains 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 plot_digits(data): | |
fig, axes = plt.subplots(10, 10, figsize=(10, 10), | |
subplot_kw={'xticks':[], 'yticks':[]}, | |
gridspec_kw=dict(hspace=0.1, wspace=0.1)) | |
for i, ax in enumerate(axes.flat): | |
ax.imshow(data[i], | |
cmap='binary', interpolation='nearest', | |
clim=(0, 16)) | |
plt.show() |
This file contains 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
class ABC(): | |
def __init__(my_parameter): | |
self.my_object_variable = my_parameter | |
def whatever_shit(): | |
print(self.my_object_variable) |
This file contains 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 _thread | |
import ...whatever the orderbook needs to be.. | |
def multi_order_sumit(thread_num): | |
print("This is thread",thread_num) | |
LOB = instance of an orderbook please () | |
for i in range(1000): | |
result = LOB.submit_order( some test cases with incermentally groving price or such...) #or whatever it is callled | |
return whatever we ecpect result to be |
This file contains 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
# -*- coding: utf-8 -*- | |
import threading | |
import time | |
#import queue | |
#import logging | |
from unittest import TestCase | |
from HFTOrderbook.lob import LimitOrderBook, Order |
This file contains 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
my_dict={"key1":(1,2,13141), "key2":(1,2,4354365462)} | |
for k,v in my_dict.items(): | |
tmp = my_dict[k] | |
tmp = (tmp[0],tmp[1],"owerwritten") | |
my_dict[k]=tmp | |
print(my_dict) | |
assert my_dict["key1"]==my_dict["key2"] |
This file contains 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
my_dict={"key1":13,"key2":14} | |
assert type(my_dict) == type({}) | |
print(my_dict.keys()) | |
print(my_dict.values()) | |
print(my_dict.items()) | |
for i in my_dict.items(): | |
print(i) |
This file contains 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 pandas as pd | |
from sqlalchemy import create_engine | |
... | |
engine = create_engine('postgresql://'+user+':'+password+'@'+host+':'+port+'/'+dbname,echo=False) | |
df_orderbook = pd.read_sql_query('select * from "public_orderbook"',con=engine) |
This file contains 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
Fltered by area and by contractid. | |
Unsorted is sorted only by created_at, "sorted" is sorted by revisionNo. | |
Unsorted: Sorted: | |
469 469 | |
470 470 | |
471 471 | |
472 472 | |
473 473 |
This file contains 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 orderbook import OrderBook | |
contract_ids = [111,2222,3333,4444]#df...contractId.unique() | |
orderbooks={} | |
for contract_id in contract_ids: | |
orderbooks[contract_id]=OrderBook() |
OlderNewer