31 lines
996 B
Python
31 lines
996 B
Python
from toss_api import TossInvestAPI
|
|
|
|
def main():
|
|
# 1. API 객체 초기화
|
|
api = TossInvestAPI()
|
|
|
|
# 2. 내 계좌 잔고 확인
|
|
print("계좌 잔고 조회 중...")
|
|
balance = api.get_account_balance()
|
|
print(balance)
|
|
|
|
# 3. 전략 예시: 전날 활발했던 종목(예: 삼성전자 '005930')의 중간 가격 계산 로직 (구현 필요)
|
|
target_ticker = "005930"
|
|
|
|
print(f"{target_ticker} 현재가 조회 중...")
|
|
current_price_info = api.get_current_price(target_ticker)
|
|
print(current_price_info)
|
|
|
|
# 4. 하한 목표가 매수 주문 예시
|
|
# buy_price = 계산된_하한가
|
|
# buy_result = api.create_order(target_ticker, "BUY", price=buy_price, quantity=10)
|
|
# print(buy_result)
|
|
|
|
# 5. 매수 완료 후 상한 목표가 매도 주문 예시
|
|
# sell_price = 계산된_상한가
|
|
# sell_result = api.create_order(target_ticker, "SELL", price=sell_price, quantity=10)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|