kabutobashi¶
code status
package status
kabutobashi is to provide convenient Python functions for analyze stocks.
kabutobashi
can
crawl Japanese stock data
analyze, visualize and parameterize stock based on charts
Installation¶
kabutobashi can be installed from pip.
pip install kabutobashi
Concept¶
E
: EntityVO
: ValueObjectS
: ServiceA
: Aggregate
graph TD;
subgraph Stock
stock[Stock:E]
brand[StockBrand:E]
record[StockRecord:E]
indicator[StockIndicator:E]
stock --> brand
stock --> record
stock --> indicator
end
subgraph Stock-to-Analysis
aggregate[StockCodeSingleAggregate:A]
processed[StockDataProcessed:VO]
estimated[StockDataEstimated:VO]
aggregate --- |Info| stock
aggregate --- |Method| processed
aggregate --- |Analysis| estimated
end
subgraph Repositories/Storage
repositories[(Storage/Database)] --- | read/write | stock
end
subgraph Pages
raw_html[RawHtml:VO]
decoder[Decoder:S]
decoded_html[DecodedHtml:VO]
raw_html --> decoder
decoder --> decoded_html
decoded_html --> repositories
decoded_html --> stock
end
subgraph Repositories/Web
web[[Web]] --> | crawl | raw_html
end
Usage¶
Crawling¶
Get Japanese-Stock-Market info.
import kabutobashi as kb
stock_info = kb.crawl_info(code="1234")
ipo_info = kb.crawl_ipo(year="2022")
Analysis¶
import kabutobashi as kb
df = kb.example()
StockCodeSingleAggregate.of(entity=df, code=1375).to_processed(kb.methods)
print(processed.get_impact())
Visualize¶
You can use, but Not Completed Yet.
import kabutobashi as kb
df = kb.example()
sdp = StockCodeSingleAggregate.of(entity=df, code=1375).to_processed([kb.sma, kb.macd])
sdp.visualize()
Utilities¶
import kabutobashi as kb
target_date = "2020-01-01"
date_list = kb.get_past_n_days(target_date, n=40)