Skip to content

Commit

Permalink
Create history_candlesticks.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sunli829 committed Nov 8, 2023
1 parent fb1f9b1 commit 50c872c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions examples/python/history_candlesticks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import datetime
from longbridge.openapi import QuoteContext, Config, SubType, PushQuote, Period, AdjustType

config = Config.from_env()
ctx = QuoteContext(config)

# get candlesticks by offset
print("get candlesticks by offset")
print("====================")
candlesticks = ctx.history_candlesticks_by_offset("700.HK", Period.Day, AdjustType.NoAdjust, False, datetime.datetime(2023, 1, 8), 10)
for candlestick in candlesticks:
print(candlestick)

# get candlesticks by date
print("get candlesticks by date")
print("====================")
candlesticks = ctx.history_candlesticks_by_date("700.HK", Period.Day, AdjustType.NoAdjust, datetime.date(2022, 5, 5), datetime.date(2022, 9, 25))
for candlestick in candlesticks:
print(candlestick)

0 comments on commit 50c872c

Please sign in to comment.