Skip to content

Instantly share code, notes, and snippets.

@goraj
goraj / GetSparseCountFingerprint.py
Created November 5, 2019 15:15
GetSparseCountFingerprint.py
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)
{
"smarts": "[#9,#17,#35,#53]-[*:1]",
"limit": 10,
"offset": 0,
"search_conditions": [
{
"condition": "and_",
"filters": [
{
"kind": "location",
@goraj
goraj / st_rerun.py
Last active April 2, 2021 19:15 — forked from demmerichs/st_rerun.py
Rerun a Streamlit 0.57.3 app from the top! See https://discuss.streamlit.io/t/update-sidebar/531
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))
@goraj
goraj / nautilus_parquet_example.py
Last active February 19, 2022 19:59
nautilus parquet example
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
@goraj
goraj / openeye_bug.ipynb
Created March 31, 2022 14:38
openeye_bug.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@goraj
goraj / exchanges.json
Created January 31, 2023 01:59
exchanges.json
{
"results": [
{
"id": 1,
"type": "exchange",
"asset_class": "stocks",
"locale": "us",
"name": "NYSE American, LLC",
"acronym": "AMEX",
"mic": "XASE",
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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"),
@goraj
goraj / config_network
Created June 6, 2024 10:01
OpenWRT Telekom VDSL2 bridge
# /etc/config/network
config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fd00:ab:cd::/48'