Getting Profit and Loss Make Easy From Binance

Overview

Getting Profit and Loss Make Easy From Binance

I have been in Binance Automated Trading for some time and have generated a lot of transaction records, so I want to see my historical profit and loss records (for each cryptocurrency). But Binance does not provide this information.

After searching for a period of time, various useful code sections were integrated, and then presented graphically with Poltly.

The usage is very simple, just follow the following operations to get the total profit and loss in historical.

Requirement

python-binance

pip install python-binance

plotly

pip install plotly==4.14.3

jupyter-dash

pip install jupyter-dash

Usage

from calcuation import profit_loss
from chart import RealizedProfitLoss
from binance.client import Client
import pandas as pd

key = 'Your API Key'
secret = 'Yout Secert Key'

client = Client(key, secret)

Get the profit and loss of BTCUSDT from 2020-01-01 to 2021-12-21

pnl = profit_loss(market='BNB-USDT', client=client, showlog=True)

output

Get the profit and loss chart of [crypto pair] every 30 days from 2020-01 to 2021-12

from datetime import datetime

dates_df = pd.DataFrame(index=[datetime(2020,1,1), datetime(2021,12,31)])
dates = dates_df.resample('d').first().index[::30]
profilio = []
for s in ['BTC-USDT', 'BNB-USDT', 'LINK-USDT', 'ADA-USDT', 'CAKE-USDT', 'UNI-USDT', 'ETH-USDT']:        
    for start_date, end_date in zip(dates[:], dates[1:]):        
        pnl = profit_loss(market=s, start_date=start_date.strftime("%Y-%m-%d"), end_date=end_date.strftime("%Y-%m-%d"), client=client)
        profilio.append({'date': end_date, 'symbol':s, 'pnl':pnl['total_profit(quote)']})    
    
profilio_df = pd.DataFrame(profilio)
profilio_df = profilio_df.rename({'symbol':'stock_id'}, axis='columns')    
RealizedProfitLoss(profilio_df).run_dash()

Pnl DashBoard

Polyglot Machine Learning example for scraping similar news articles.

Polyglot Machine Learning example for scraping similar news articles In this example, we will see how we can work with Machine Learning applications w

MetaCall 15 Mar 28, 2022
🌊 River is a Python library for online machine learning.

River is a Python library for online machine learning. It is the result of a merger between creme and scikit-multiflow. River's ambition is to be the go-to library for doing machine learning on strea

OnlineML 4k Jan 03, 2023
Pragmatic AI Labs 421 Dec 31, 2022
Generate music from midi files using BPE and markov model

Generate music from midi files using BPE and markov model

Aditya Khadilkar 37 Oct 24, 2022
🎛 Distributed machine learning made simple.

🎛 lazycluster Distributed machine learning made simple. Use your preferred distributed ML framework like a lazy engineer. Getting Started • Highlight

Machine Learning Tooling 44 Nov 27, 2022
Library for machine learning stacking generalization.

stacked_generalization Implemented machine learning *stacking technic[1]* as handy library in Python. Feature weighted linear stacking is also availab

114 Jul 19, 2022
Implementation of deep learning models for time series in PyTorch.

List of Implementations: Currently, the reimplementation of the DeepAR paper(DeepAR: Probabilistic Forecasting with Autoregressive Recurrent Networks

Yunkai Zhang 275 Dec 28, 2022
scikit-learn: machine learning in Python

scikit-learn is a Python module for machine learning built on top of SciPy and is distributed under the 3-Clause BSD license. The project was started

neurodata 3 Dec 16, 2022
Machine Learning for Time-Series with Python.Published by Packt

Machine-Learning-for-Time-Series-with-Python Become proficient in deriving insights from time-series data and analyzing a model’s performance Links Am

Packt 124 Dec 28, 2022
A comprehensive repository containing 30+ notebooks on learning machine learning!

A comprehensive repository containing 30+ notebooks on learning machine learning!

Jean de Dieu Nyandwi 3.8k Jan 09, 2023
A demo project to elaborate how Machine Learn Models are deployed on production using Flask API

This is a salary prediction website developed with the help of machine learning, this makes prediction of salary on basis of few parameters like interview score, experience test score.

1 Feb 10, 2022
Formulae is a Python library that implements Wilkinson's formulas for mixed-effects models.

formulae formulae is a Python library that implements Wilkinson's formulas for mixed-effects models. The main difference with other implementations li

34 Dec 21, 2022
A repository of PyBullet utility functions for robotic motion planning, manipulation planning, and task and motion planning

pybullet-planning (previously ss-pybullet) A repository of PyBullet utility functions for robotic motion planning, manipulation planning, and task and

Caelan Garrett 260 Dec 27, 2022
2021 Machine Learning Security Evasion Competition

2021 Machine Learning Security Evasion Competition This repository contains code samples for the 2021 Machine Learning Security Evasion Competition. P

Fabrício Ceschin 8 May 01, 2022
Lightning ⚡️ fast forecasting with statistical and econometric models.

Nixtla Statistical ⚡️ Forecast Lightning fast forecasting with statistical and econometric models StatsForecast offers a collection of widely used uni

Nixtla 2.1k Dec 29, 2022
Model Agnostic Confidence Estimator (MACEST) - A Python library for calibrating Machine Learning models' confidence scores

Model Agnostic Confidence Estimator (MACEST) - A Python library for calibrating Machine Learning models' confidence scores

Oracle 95 Dec 28, 2022
High performance Python GLMs with all the features!

High performance Python GLMs with all the features!

QuantCo 200 Dec 14, 2022
A Lightweight Hyperparameter Optimization Tool 🚀

The mle-hyperopt package provides a simple and intuitive API for hyperparameter optimization of your Machine Learning Experiment (MLE) pipeline.

Robert Lange 137 Dec 02, 2022
Cohort Intelligence used to solve various mathematical functions

Cohort-Intelligence-for-Mathematical-Functions About Cohort Intelligence : Cohort Intelligence ( CI ) is an optimization technique. It attempts to mod

Aayush Khandekar 2 Oct 25, 2021
Pandas DataFrames and Series as Interactive Tables in Jupyter

Pandas DataFrames and Series as Interactive Tables in Jupyter Star Turn pandas DataFrames and Series into interactive datatables in both your notebook

Marc Wouts 364 Jan 04, 2023