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 struct import calcsize | |
import polars as pl | |
def scid_parse_trades(filepath: str) -> pl.DataFrame: | |
"""Sierrachart's SCID format. Must be configured to record single trade ticks.""" | |
intraday_record_struct = np.dtype( | |
[ | |
("timestamp", "<q"), | |
("open", "<f"), | |
("ask_price", "<f"), |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
{ | |
"results": [ | |
{ | |
"id": 1, | |
"type": "exchange", | |
"asset_class": "stocks", | |
"locale": "us", | |
"name": "NYSE American, LLC", | |
"acronym": "AMEX", | |
"mic": "XASE", |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 nautilus_trader.backtest.data.wranglers import BarDataWrangler | |
from nautilus_trader.persistence.external.readers import ParquetReader | |
from nautilus_trader.persistence.catalog import DataCatalog | |
from functools import partial | |
from nautilus_trader.core.datetime import dt_to_unix_nanos | |
from nautilus_trader.model.c_enums.bar_aggregation import BarAggregation | |
from nautilus_trader.model.data.bar import Bar, BarType, BarSpecification | |
from nautilus_trader.model.enums import AggregationSource, PriceType | |
from nautilus_trader.persistence.external.core import process_files, write_objects |
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 streamlit.ReportThread as ReportThread | |
from streamlit.ScriptRequestQueue import RerunData | |
from streamlit.ScriptRunner import RerunException | |
from streamlit.server.Server import Server | |
def rerun(): | |
"""Rerun a Streamlit app from the top!""" | |
widget_states = _get_widget_states() | |
raise RerunException(RerunData(widget_states)) |
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
{ | |
"smarts": "[#9,#17,#35,#53]-[*:1]", | |
"limit": 10, | |
"offset": 0, | |
"search_conditions": [ | |
{ | |
"condition": "and_", | |
"filters": [ | |
{ | |
"kind": "location", |
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 scipy.sparse import csr_matrix | |
from rdkit import Chem | |
from rdkit.Chem.rdFingerprintGenerator import GetRDKitFPGenerator | |
smiles = 'CC1=C(C=C(C=C1)NC(=O)C2=CC=C(C=C2)CN3CCN(CC3)C)NC4=NC=CC(=N4)C5=CN=CC=C5' | |
molobj = Chem.MolFromSmiles(smiles) | |
for max_path in [2,3,4,5,6,7]: | |
rdk_gen = GetRDKitFPGenerator(maxPath=max_path) | |
fp = rdk_gen.GetSparseCountFingerprint(molobj) |
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 typing import List | |
import pandas as pd | |
def explode_multi_column( | |
df: pd.DataFrame, index_cols: List[str], sep: str | |
): | |
""" | |
In [13]: |
NewerOlder