henrydatei / wikifolio-trading-api

A Python Wrapper for the official Wikifolio Trading API
MIT License
2 stars 1 forks source link

wikifolio-trading-api

A Python Wrapper for the official Wikifolio Trading API

Wikifolio has realeased an official API for trading. This is a Python wrapper for this API. Instead of using https://github.com/henrydatei/wikifolio-api, you can use this wrapper to trade with your wikifolio if you have a client api key and a user api key. To get these keys, you have to

Although this wrapper can automate your trading you should not officially do it. Wikifolio does not like it and they can block your account. So use it at your own risk. What is possible is that a user clicks a button and then the wrapper does the trading, i.e. rebalancing the wikifolio.

TODOs

Usage

If published on PyPi, you can install it with

pip install wikifolioTradingAPI // not yet published and unsure if this name is available

Alternatively, you can clone this repository and create a file in it with the following content:

from wikifolioTradingAPI import WikifolioTradingAPI
import datetime

wf_api = WikifolioTradingAPI("my_client_api_key", "my_user_api_key")
print(wf_api.list_wikifolios())
print(wf_api.get_wikifolio('wf0spc2022'))
# print(wf_api.list_wikifolio_underlyings('wf0spc2022')) # It says it found 2677 underlyings??? This wikifolio has 8 positions. Maybe it lists all possible underlyings?
print(wf_api.list_wikifolio_orders('wf0spc2022'))
orderid = wf_api.place_limit_order('wf0spc2022', 'US0378331005', 1, 150, datetime.date(2024,7,28) ,'buy')
print(wf_api.get_limit_order(orderid))
wf_api.delete_limit_order(orderid)
print(wf_api.place_quote_order('wf0spc2022', 'US0378331005', 1, 'buy'))