Skip to content

Instantly share code, notes, and snippets.

#먼저 인바운드 규칙을 만드세요.
# PowerShell 스크립트
# 1. 기존 portproxy 설정 삭제
netsh interface portproxy delete v4tov4 listenport=4000 listenaddress=0.0.0.0
# 2. WSL2의 eth0 IP 주소 가져오기
$wslIP = wsl hostname -I | ForEach-Object { $_.Trim() }
# 3. 새로운 portproxy 설정 추가
@SnowyPainter
SnowyPainter / localbns3axishedge.py
Created September 23, 2024 11:41
Local BNS algorithm, 3 axis hedge portfolio functions.
import numpy as np
import pandas as pd
from scipy.optimize import minimize
import numpy as np
'''
주식 A를 헤지하기 위해서 주식 B1, B2가 사용됨.
조건: (A)와 (B1, B2)는 다른 섹터에서 상관계수가 -1에 가까워야함
조건2: 사실 뭐든 상관없음
import mojito
import websockets
import json
import requests
import os
import asyncio
import time
from Crypto.Cipher import AES
from Crypto.Util.Padding import unpad
import mojito
import pprint
key = "발급받은 API KEY"
secret = "발급받은 API SECRET"
acc_no = "12345678-01"
broker = mojito.KoreaInvestment(
api_key=key,
api_secret=secret,
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout
from tensorflow.keras.optimizers import RMSprop
import numpy as np
import random
class QLearningAgent:
def __init__(self, env, learning_rate=0.1, discount_factor=0.99, epsilon=0.1):
self.env = env
self.step_size = learning_rate
@SnowyPainter
SnowyPainter / data.py
Last active January 18, 2024 10:50
3개 이상 merge
import pandas as pd
import numpy as np
files = ["nvda.csv", "vix.csv", "eur.csv"]
def open_df(fn):
df = pd.read_csv(fn)
df.drop(["Vol.","Change %","Open","Low","High"], axis=1, inplace=True)
df["Price"] = df["Price"].astype(float)
df['Date'] = pd.to_datetime(df['Date'], format='%m/%d/%Y')
@SnowyPainter
SnowyPainter / wjdqhtngod.py
Created October 27, 2023 09:58
wjdqhtngod.py
import random
computer = random.randint(1,3)
player = int(input("가위, 바위, 보 중 하나를 선택하시오. (가위=1, 바위=2, 보=3): "))
if computer == player:
print("비겼습니다.")
elif player == 1:
if computer == 2:
print("졌습니다 (가위<바위)")
import matplotlib.pyplot as plt
class Neuron:
def __init__(self, package):
self.schwannCells = 0
self.Ranviers = -1
self.neurotransmitter = package
self.Potential = -70
self.i = 0
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.datasets import load_iris
def andrews_curve(data, weights=None):
num_variables = data.shape[1]
t = np.linspace(0, 2*np.pi, 100)
curve = np.zeros((len(t), 2))
import random
sn1 = ['It', 'is', 'a fundraising event', 'which', 'is held', 'on', 'a Friday', 'in March', 'every', 'other', 'year']
sn2 = ['Foodbank', 'also supports', 'food drives', 'for', 'individuals', 'who', 'want', 'to', 'share', 'their', 'food', 'with', 'the', 'poor', 'in the', 'country']
sn3 = ['When', 'I', 'called', "Foodbank's office", 'people', 'there', 'let', 'me', 'know', 'in detail', 'how', 'I', 'could', 'donate', 'food', 'to', 'the', 'hungry']
sn4 = ['These thousands', 'of', 'Santas', 'spread', 'the spirit', 'of', 'Christmas', 'to', 'Australian kids', 'who are', 'sick', 'or', 'disadvantaged']
sn5 = ['He', 'led', 'a', 'mostly', 'unremarkable', 'life', ', working', 'as', 'a', 'Paris customs service officer', 'until', 'his', 'late', 'forties']
sn6 = ['The', 'public', 'and', 'critics', 'laughed at', "Rousseau's", 'flat,', 'seemingly', 'childish', 'style', 'of', 'portraying', 'human', 'figures']
sn7 = ['In', 'this', 'way,', 'he', 'created', 'his', 'own', 'mysterious', 'jungle', 'paintings', 'where',