This file contains 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
/* | |
CCy_AP909_TA_DB_Sqlite_1.mqh | |
2024.10.26 | |
CyEA909 에서 활용되는 SQLite DB CyEA909.sqlite 핸들링. | |
- 종목별로 다른 정보(예 : 커미션)이면서 mql5 에서 함수 제공안되는 것들 처리위함. |
This file contains 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
/* | |
함수 설명: Get_Loss_Spread_USD(double volume_lot) | |
목적: 거래 종목의 스프레드로 인해 발생하는 USD 손실을 계산. 반환값은 항상 음수. | |
매개변수: volume_lot - 거래량을 랏 단위로 받음. | |
포인트 단위 스프레드: | |
SymbolInfoInteger 함수로 종목의 스프레드를 포인트 단위로 가져옴. | |
1랏 기준 USD 금액: | |
SymbolInfoDouble 함수로 가격 1 Tick의 USD 값을 가져옴. 상대 통화의 USD 환율에 따라 변경됨. |
This file contains 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
from pybit.unified_trading import WebSocket | |
from time import sleep | |
import queue | |
import threading | |
# multi symbol | |
symbols_to_get_tick = ["BTCUSDT", "ETHUSDT", "SOLUSDT", "SUIUSDT", "XRPUSDT"] | |
category = "linear" | |
# 모든 심볼의 최신 틱 데이터를 저장할 dictionary. key=symbol name |
This file contains 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
from pybit.unified_trading import WebSocket | |
from time import sleep | |
# multi symbol | |
symbols_to_get_tick = ["BTCUSDT", "ETHUSDT", "SOLUSDT", "SUIUSDT", "XRPUSDT"] | |
category = "linear" | |
# 모든 심볼의 최신 틱 데이터를 저장할 dictionary. key=symbol name | |
symbol_tick_last = {} |
This file contains 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
from pybit.unified_trading import WebSocket | |
from time import sleep | |
# Tick 데이터 형식 정의 | |
tick_dict = { | |
'timestamp_ms': int, # 밀리초 단위의 타임스탬프 | |
'symbol': str, # 거래 심볼 |
This file contains 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
# Tick 데이터 형식 정의 | |
tick_dict = { | |
'timestamp_ms': int, # 밀리초 단위의 타임스탬프 | |
'symbol': str, # 거래 심볼 | |
'side': str, # 매수/매도 측 (예: "Buy", "Sell") | |
'volume_base': str, # 기본 통화의 거래량 (문자열로 처리) | |
'volume_quote': str, # 기준 통화의 거래량 (문자열로 처리) | |
'block_trade': str # 블록 거래 여부 (문자열로 처리) | |
} |
This file contains 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 handle_message(message): | |
if 'data' in message: | |
data = message['data'] | |
for tick_data in data: | |
print("Received Tick Data:", tick_data) | |
else: | |
print("Received Message without 'data' field:", message) |
This file contains 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
from pybit.unified_trading import WebSocket | |
from time import sleep | |
# 메시지 핸들러 함수 정의 | |
def handle_message(message): | |
print(message) | |
def main(): |
This file contains 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
/* | |
MetaTrader5 language MQL5 | |
- Only for 64bit environment | |
file : CCy_IPC_SendCopyData_1.mqh | |
author : igotit . https://igotit.tistory.com | |
*/ | |
This file contains 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
/* | |
MetaTrader5 language MQL5 | |
- Only for 64bit environment | |
file : CCy_IPC_WindowMessage_1.mqh | |
author : igotit . https://igotit.tistory.com | |
*/ | |
#define WM_USER 0x0400 // Windows Message User 정의 |
NewerOlder