Skip to content

Instantly share code, notes, and snippets.

@SnowyPainter
Created February 27, 2024 20:58
Show Gist options
  • Save SnowyPainter/448874d4da437579b462e5983e046d7d to your computer and use it in GitHub Desktop.
Save SnowyPainter/448874d4da437579b462e5983e046d7d to your computer and use it in GitHub Desktop.
import mojito
import pprint
key = "발급받은 API KEY"
secret = "발급받은 API SECRET"
acc_no = "12345678-01"
broker = mojito.KoreaInvestment(
api_key=key,
api_secret=secret,
acc_no=acc_no,
exchange='나스닥'
)
balance = broker.fetch_present_balance()
pprint.pprint(balance)
price = broker.fetch_price("TSLA")
pprint.pprint(price)
def buy():
res = broker.create_limit_buy_order(
symbol="TQQQ",
price=60,
quantity=5
)
pprint.pprint(res)
def sell():
resp = broker.create_limit_sell_order(
symbol="TQQQ",
price=30,
quantity=5
)
pprint.pprint(resp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment