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
,exchange,symbol,timestamp_ms,open,high,low,close,volume,is_dummy,datetime_utc,datetime,year,month,day,datetime_diff_sec,hour,minute,candle_height,pct_change_close,ema_short_periods,ema_long_periods,ema_close,std,h_l,h_pc,l_pc,tr,atr,hurst_exp,boillenger_upper,boillenger_lower,close_delta,up,down,rsi,macd,signal,macd_minus_signal,ema_short_slope,ema_long_slope,gap_close_vs_ema,close_above_or_below_ema,close_vs_ema_inflection | |
1,okx_linear,BTC/USDT:USDT,1609459200000.0,28914.2,29637.8,28620.0,29333.6,2520243.0,False,2021-01-01,2021-01-01 08:00:00,2021,1,1,28800.0,8,0,1017.7999999999993,,29333.6,29333.6,29333.6,,1017.7999999999993,,,1017.7999999999993,,,,,,,,,0.0,0.0,0.0,,,0.0,,0.0 | |
2,okx_linear,BTC/USDT:USDT,1609545600000.0,29329.9,33367.9,28953.1,32166.9,5881082.0,False,2021-01-02,2021-01-02 08:00:00,2021,1,2,86400.0,8,0,4414.800000000003,9.658889464641241,29551.546153846157,29408.160526315787,29408.160526315787,,4414.800000000003,4034.300000000003,380.5,4414.800000000003,,,,,2833.300000000003,2833.300000000003 |
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 os | |
import sys | |
import json | |
from datetime import datetime | |
import logging | |
import arrow | |
from typing import Dict, List | |
import enum | |
import math | |
import pandas as pd |
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://stackoverflow.com/questions/2510593/how-can-i-set-processor-affinity-to-a-thread-or-a-task-in-net | |
using System; | |
using System.Diagnostics; | |
using System.Threading; | |
static void Fibonacci(int n) | |
{ | |
int a = 0, b = 1, c = 0; | |
for (int i = 0; i < n; i++) | |
{ |
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
using Newtonsoft.Json; | |
using System; | |
using System.Buffers; | |
using System.Collections.Generic; | |
using System.Net.WebSockets; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; | |
/* |
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
List the kind of applications you can create: | |
dotnet new list | |
To create a new 'console' app (.NET Core Console): | |
dotnet new console --framework net6.0 -n CSharpDotnetCoreConsole | |
To create a new 'webapi' project (Not 'webapp', please note): | |
dotnet new webapi --framework net6.0 -n Commander | |
To install packages from command prompt: |
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 re | |
def main(): | |
# Email validation | |
email_address = "[email protected]" | |
email_pattern = r'^\w+@[a-zA-Z_]+\.[a-zA-Z]{2,3}$' | |
if re.match(email_pattern, email_address): | |
print("Valid email address.") | |
else: |
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 aiohttp | |
import asyncio | |
''' | |
OKX API | |
OKX REST API addresses: | |
REST: https://www.okx.com/ | |
Public WebSocket: wss://ws.okx.com:8443/ws/v5/public | |
Private WebSocket: wss://ws.okx.com:8443/ws/v5/private |
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 asyncio | |
import json | |
import struct | |
from websockets import connect | |
''' | |
https://gist.github.com/normanlmfung/b4a0354d3f8fcba440d9b3716f407be0 | |
OKX API |
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
using Newtonsoft.Json; | |
using System; | |
using System.Collections.Generic; | |
using System.Net.WebSockets; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; | |
/* | |
'AllocateMemory' will allocate byte[] pinned in memory. You'd only do this ONCE. Pinned memory will not be garbage collected, reducing performance impact from GC. |
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 asyncio | |
import threading | |
from datetime import datetime | |
''' | |
https://stackoverflow.com/questions/76856816/python-how-to-create-cpu-load-that-block-asyncio-event-loop?noredirect=1#comment135492684_76856816 | |
''' | |
def log(msg): | |
print(f"{datetime.now()} {msg}") |