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"), |
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 make_window_borderless(self): | |
""" | |
Requires: pywin32 | |
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pywin32 | |
import win32gui as wg | |
import win32api as wa | |
import win32con as wc | |
Based on: https://github.com/howardjohn/pyty/blob/master/src/window_api.py | |
""" |
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]: |
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
# -*- coding: utf-8 -*- | |
""" | |
@author: goraj | |
""" | |
import lightgbm as lgbm | |
from sklearn.datasets import load_digits | |
import numpy as np | |
from sklearn.model_selection import train_test_split | |
from sklearn.metrics import roc_auc_score |
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)) |
NewerOlder