A client for the Trading212 API
pip install python-trading212
Set your API key in the environment variable:
export TRADING212_API_KEY=<your-api-key>
from trading212 import Trading212, Pie
trading212 = Trading212()
pie: Pie = trading212.fetch_pie(123)
positions: List[Position] = trading212.fetch_all_open_positions()
trading212.create_pie(
Pie(
name='My Pie',
...
)
)
- Exchange List
- Instrument List
- Fetch all pies
- Create Pie
- Delete Pie
- Fetch a Pie
- Update pie
- Fetch all
- Place Limit order
- Place Market order
- Place Stop order
- Place StopLimit order
- Cancel by ID
- Fetch by ID
- Fetch account cash
- Fetch account metadata
- Fetch all open positions
- Fetch a specific position
- Historical order data
- Paid out dividens
- Exports List
- Export csv
- Transaction list
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.