Skip to content

Commit

Permalink
[#1] update : cors처리, 종가 -> ohlc로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
kimhaech committed Nov 20, 2023
1 parent a12577d commit 51d735b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
13 changes: 13 additions & 0 deletions api/server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from fastapi import FastAPI, APIRouter
from fastapi.middleware.cors import CORSMiddleware
import sys
from PyQt5.QtGui import *
from PyQt5.QtCore import *
Expand All @@ -11,6 +12,18 @@
# server app
app = FastAPI()

# 허용할 origin
origin = ["*"]

# middleware 등록
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)

# indi instance
indi_app_instance = None

Expand Down
7 changes: 4 additions & 3 deletions common/indi_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,7 @@ async def search_stock_news_detail(self, req_news_type_code, req_search_date, re


# -----------------------------------------------------------
# TR data 처리 - 참고용


# TR data 처리
def TRShow_ReceiveData(self, giCtrl, rqid):
# receive시 출력
print("in receive_Data:", rqid)
Expand Down Expand Up @@ -377,6 +375,9 @@ def TRShow_ReceiveData(self, giCtrl, rqid):
for i in range(0, nCnt):
tr_data_output.append({})
tr_data_output[i]["date"] = str(giCtrl.GetMultiData(i, 0))
tr_data_output[i]["open"] = str(giCtrl.GetMultiData(i, 2))
tr_data_output[i]["high"] = str(giCtrl.GetMultiData(i, 3))
tr_data_output[i]["low"] = str(giCtrl.GetMultiData(i, 4))
tr_data_output[i]["close"] = str(giCtrl.GetMultiData(i, 5))

print(TRShow.GetErrorCode())
Expand Down

0 comments on commit 51d735b

Please sign in to comment.