Created
February 27, 2024 20:58
-
-
Save SnowyPainter/448874d4da437579b462e5983e046d7d to your computer and use it in GitHub Desktop.
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
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