Skip to content

Instantly share code, notes, and snippets.

@mr-yoo
mr-yoo / thread_terminate.py
Created July 12, 2023 13:29
Thread 종료 기능 추가
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton
from PyQt5.QtCore import QThread
import time
class Worker(QThread):
def run(self):
while True:
if self.isInterruptionRequested(): # 인터럽트 확인
print("terminate")
@mr-yoo
mr-yoo / kiwoom_candidate1.py
Created November 30, 2021 18:53
키움증권 코드 구조-2 (싱글톤 버그 있음)
import sys
from enum import Enum
from PyQt5.QtWidgets import *
from PyQt5.QAxContainer import *
from PyQt5.QtCore import *
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
@mr-yoo
mr-yoo / kiwoom_candidate0.py
Last active November 30, 2021 15:24
키움증권 코드 구조
import sys
from PyQt5.QtWidgets import *
from PyQt5.QAxContainer import *
from PyQt5.QtCore import *
class SingletonInstane:
__instance = None
@classmethod
def __getInstance(cls):
@mr-yoo
mr-yoo / multi-qtChart.py
Created June 20, 2021 13:37
두 개의 축을 갖는 QtChart
from PyQt5.QtWidgets import *
from PyQt5 import uic
from PyQt5.QtChart import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import pybithumb
import time
class ChartWorker(QThread):
# --------------------------------
@mr-yoo
mr-yoo / datetime-ex.py
Created May 30, 2021 12:05
5초에 한 번 현재 시간을 출력
import time
import datetime
while True:
now = datetime.datetime.now()
print(now)
time.sleep(5)
@mr-yoo
mr-yoo / beautifl-chart-sorting.py
Created May 16, 2021 08:15
예쁜 차트 백테스팅 (패턴 검색)
import numpy as np
import pandas as pd
import pyupbit
import time
import plotly.graph_objects as go
pat = [ 100, 90, 80, 70, 90, 120, 140 ]
tickers = pyupbit.get_tickers(fiat="KRW")
dfs = []
@mr-yoo
mr-yoo / beautifl-chart-visualization.py
Created May 16, 2021 08:14
예쁜 차트 백테스팅 시각화 (패턴검색)
from plotly.subplots import make_subplots
import plotly.graph_objects as go
import pyupbit
pat = [ 100, 90, 80, 70, 90, 120, 140 ]
df = pyupbit.get_ohlcv("KRW-XRP", count=7)
xrp = go.Scatter(
x = df.index,
y = df.close,
@mr-yoo
mr-yoo / realtime-percent1-realcoin.py
Last active March 11, 2023 12:18
실시간 1퍼센트 치고 빠지기 - 멀티 코인
import pyupbit
import time
from collections import deque
class RealOrder(pyupbit.Upbit):
def __init__(self, key0, key1):
super().__init__(key0, key1)
def get_current_price(self, ticker):
while True:
@mr-yoo
mr-yoo / realtime-percent1-multicoin-main.py
Created May 8, 2021 08:24
실시간 1퍼센트 치고 빠지기 - 멀티 코인
import threading
import queue
import time
import pyupbit
import datetime
from collections import deque
import realcoin
tickers = ["KRW-ADA", "KRW-LTC"]
@mr-yoo
mr-yoo / realtime-percent1-ver2.py
Last active December 13, 2021 06:39
실시간 1퍼센트 치고 빠지기 (ver2)
import threading
import queue
import time
import pyupbit
import datetime
from collections import deque
class Consumer(threading.Thread):
def __init__(self, q):
super().__init__()