Skip to content

Instantly share code, notes, and snippets.

View kangchihlun's full-sized avatar
🦽
日拱一卒,功不唐捐

kang chih lun kangchihlun

🦽
日拱一卒,功不唐捐
View GitHub Profile
@kangchihlun
kangchihlun / index.html
Created May 2, 2023 12:12
Pacman Concept
<script type="x-shader/x-vertex" id="shader-passthrough-vertex">
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0);
}
</script>
<script type="x-shader/x-fragment" id="shader-passthrough-fragment">
uniform sampler2D tDiffuse;
@kangchihlun
kangchihlun / distribute-reward-daily.py
Created January 9, 2023 08:25
mock daily distributed rewards
# coding=utf-8
import sys,os
import secrets
from datetime import datetime
import time
import csv
import random
class dailyRecord():
def __init__(self,name):
@kangchihlun
kangchihlun / personal_modifier_settings.ms
Created October 7, 2022 07:37
personal_modifier_settings all credits for bobo @ 2006 ADSK master class
global FF_ApplyCustomModifierSettings
fn FF_ApplyCustomModifierSettings =
(
result = callbacks.notificationParam()
theObj = result[1]
theMod = result[2]
case classof theMod of
(
Uvwmap:
(
@kangchihlun
kangchihlun / okex-request.js
Created July 10, 2022 11:47
okex-V5 api request
const fetch = require('node-fetch')
const CryptoJS = require('crypto-js')
var accessKey = ``
var passphrase = ``
var secretKey = ``
const httpGet = (url, param,accessKey,passphrase,secretKey) => {
let paramKeys = Object.keys(param)
for (let index in paramKeys) {
I am attesting that this GitHub handle kangchihlun is linked to the Tezos account tz1Pfy671qbp8g3eLjpmyt5qrLtYzKrw29RY for tzprofiles
sig:edsigtkyrV7hVVRDsxuLuE822skLgKpztYRz5tKdMvbmEuiUcnA8GkjZ8AGjNrkroHEnErFCJQWrHb4euBPrb8DLWTbA1Mpy5xN
# coding=utf-8
import os,sys
import time
liqperc = 0.05 # 清算線,抓安全一點 5%
initialCapital = 10000
omg_1231_entry_price = 13.91 # omg 1231 開倉價
omg_perp_entry_price = 15.378 # omg perp 開倉價
basis = abs(omg_perp_entry_price - omg_1231_entry_price) / omg_perp_entry_price
@kangchihlun
kangchihlun / uni-v3-price-time-range-hedged-backtest.py
Created October 25, 2021 05:18
UniswapV3 +作空永續對沖 -- 收益曲面預估
# coding=utf-8
import os,sys
import time
import math
import random
def getLowerFromUpper(
P, # 當前幣價
Pu, # 上界
@kangchihlun
kangchihlun / getTokenAmountsFromDepositAmounts.py
Last active October 16, 2021 06:00
UniswapV3計算當前美金在設定的價格帶需要兌換多少數量的 eth
# coding=utf-8
import os,sys
import time
import math
cprice_eth = 3840
cprice_matic = 1.565
lower = 2000
upper = 2991
initCapital = 6197 # 初始資金(美金)
@kangchihlun
kangchihlun / sup_pres_calculator.js
Created September 25, 2021 21:43
支撐壓力線計算-使用 Volume Profile 找過去一日一分鐘最大量區-10跳間隔
const okex_api = require('../../libs/okex-api')
const constant = require('../../libs/constants')
const request = require('request')
const numgrid = 100
var marketinfo = {}
const fetch_market_info = async () => {
let _mkt = await okex_api.fetch_perp_symbols(mode='all')
_mkt.forEach((inst) => {
marketinfo[inst.instrument_id] = inst
import ccxt
import pandas as pd
import time
pd.set_option('expand_frame_repr', False)
def main():
"""
主函数