xing-tick-crawler
๋ฐ๋์ python 32bit๋ฅผ ์ฌ์ฉ
์ค์น
pip install xing-tick-crawler
์ฌ์ฉ์์
1. config.py ํ์ผ ์์ฑ ๋ฐ ์ค์
config = {
"id" : "my_id" , # xing api ์์ด๋
"password" : "my_password" , # xing api ํจ์ค์๋
"cert_password" : "my_cert_password" , # ๊ณต๋์ธ์ฆ์ ๋น๋ฐ๋ฒํธ
}
RES_FOLDER_PATH = "C:/eBEST/xingAPI/Res" # xing_tick_crawler Res ํ์ผ ํด๋ ์์น
TICKER_DATA_FOLDER_PATH = "." # tick ๋ฐ์ดํฐ ์ ์ฅํ ์์น
2. main.py ์์ฑ ๋ฐ ์คํ
ํ์์๋ ๋ฐ์ดํฐ off ํ๊ณ , ์คํ
"""
ํฌ๋กค๋ฌ 1 ๊ตฌ๋
์ต์
(๊ธฐ๋ณธ๊ฐ All True)
- STOCK_VI_ON_OFF
- KOSPI_ORDER_BOOK
- KOSPI_AFTER_MARKET_ORDER_BOOK
- KOSPI_AFTER_MARKET_TICK
- KOSPI_BROKER_INFO
- STOCK_FUTURES_ORDER_BOOK
- STOCK_FUTURES_TICK
ํฌ๋กค๋ฌ 2 ๊ตฌ๋
์ต์
(๊ธฐ๋ณธ๊ฐ All True)
- KOSDAQ_ORDER_BOOK
- KOSDAQ_AFTER_MARKET_ORDER_BOOK
- KOSDAQ_AFTER_MARKET_TICK
- KOSDAQ_BROKER_INFO
"""
from xing_tick_crawler .crawler import crawler_1 , crawler_2 , crawl_kospi_tick , crawl_kosdaq_tick
from datetime import datetime
from multiprocessing import Process , get_context
from multiprocessing .queues import Queue
if __name__ == "__main__" :
crawler_1_subs_option = {
# ์ฃผ์ VI ์ ๋ณด off
'STOCK_VI_ON_OFF' : False ,
}
crawler_2_subs_option = {
}
queue = Queue (ctx = get_context ())
p1 = Process (target = crawl_kospi_tick , args = (queue ,))
p2 = Process (target = crawl_kosdaq_tick , args = (queue ,))
p3 = Process (target = crawler_1 , args = (queue ,), kwargs = crawler_1_subs_option )
p4 = Process (target = crawler_2 , args = (queue ,), kwargs = crawler_2_subs_option )
p1 .start ()
p2 .start ()
p3 .start ()
p4 .start ()
while True :
tick = queue .get ()
waiting_tasks = queue .qsize ()
tick_type , tick_data = tick
print (f"\r { datetime .now ()} waiting tasks : { '%6d' % waiting_tasks } " , end = '' )
print (tick_type , tick_data )
๊ตฌํ Real ๋ชฉ๋ก
์ฃผ์์์ฅ
์ ๋ฌผ์ต์
์์ฅ