- https://stackoverflow.com/questions/66081709/whats-the-proposed-way-to-switch-to-native-homebrew-on-m1-macbooks
- https://stackoverflow.com/questions/65901162/how-can-i-run-pyqt5-on-my-mac-with-m1chip
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
| #https://pastebin.com/jgr4ZBVK | |
| #https://www.reddit.com/r/algotrading/comments/p4flbp/can_i_make_tick_volume_and_dollar_bars_from_ohlc/ | |
| class VolumeBarAggregator(): | |
| class NumpyWrapper(): | |
| def __init__(self, length): | |
| self.arr = np.array(dtype=float, ) | |
| def __init__(self): |
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 cpcv_generator(t_span, n, k, verbose=True): | |
| # split data into N groups, with N << T | |
| # this will assign each index position to a group position | |
| group_num = np.arange(t_span) // (t_span // n) | |
| group_num[group_num == n] = n-1 | |
| # generate the combinations | |
| test_groups = np.array(list(itt.combinations(np.arange(n), k))).reshape(-1, k) | |
| C_nk = len(test_groups) | |
| n_paths = C_nk * k // 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
| # | |
| # Binance-аас 1 минутын чартыг бодит хугацаанд татаж харуулах | |
| # | |
| # sudo apt-get install python3-pyqt5 | |
| # virtualenv -p python3 env && source env/bin/activate | |
| # pip install finplot requests websocket scipy | |
| import json | |
| import requests | |
| import websocket |
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
| brew install hdf5 | |
| export HDF5_DIR=/opt/homebrew/Cellar/hdf5/1.12.0_4 | |
| pip3 install --no-binary=h5py h5py | |
| virtualenv -p python env && source env/bin/activate | |
| pip install h5py | |
| pip install tensorflow-macos | |
| pip install tensorflow-metal |
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
| #!/usr/bin/env python3 | |
| '''2021-03-26: Reverse-engineer by searching for the following terms in features*.js: | |
| - bracketMaintenanceMarginRate | |
| - cumFastMaintenanceAmount | |
| - bracketNotionalFloor | |
| - bracketNotionalCap''' | |
| # (max) position, maintenance margin, maintenance amount | |
| maint_lookup_table = [ |
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
| # Store the short term moving average in a new column 'window_ST' | |
| prices.loc[:, 'window_ST'] = prices['close'].rolling( | |
| context.short_term_window).mean() | |
| # Store the long term moving average in a new column 'window_LT' | |
| prices.loc[:, 'window_LT'] = prices['close'].rolling( | |
| context.long_term_window).mean() | |
| # Get the latest signal, 1 for golden cross, -1 for death cross | |
| prices.loc[:, 'signal'] = np.where( |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
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
| Date Open High Low Close Volume | |
| 2020-05-06 18:15:00-04:00 2832 2838.5 2832 2838 3750 | |
| 2020-05-06 18:30:00-04:00 2838 2838.5 2826 2827.75 6864 | |
| 2020-05-06 18:45:00-04:00 2827.75 2830.5 2827 2829.5 2937 | |
| 2020-05-06 19:00:00-04:00 2829.5 2830.5 2823 2826.5 4619 | |
| 2020-05-06 19:15:00-04:00 2826.75 2829.5 2825.25 2827.75 3610 | |
| 2020-05-06 19:30:00-04:00 2827.75 2829.5 2825.5 2826.75 2460 | |
| 2020-05-06 19:45:00-04:00 2826.75 2830.75 2826.25 2830.5 2531 | |
| 2020-05-06 20:00:00-04:00 2830.5 2833.5 2830.25 2833.5 2361 |
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
| # References : | |
| # - https://stackoverflow.com/questions/61776425/logic-for-real-time-algo-trading-expert | |
| import pytz | |
| import pandas as pd | |
| import MetaTrader5 as mt5 | |
| import time | |
| from datetime import datetime | |
| from threading import Timer |
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 select | |
| import datetime | |
| import psycopg2 | |
| import psycopg2.extensions | |
| conn = psycopg2.connect(database="postgres", user="vagrant") | |
| #conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT) | |
| curs = conn.cursor() |