Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
nsrwork committed Sep 24, 2023
1 parent 0ccb85a commit 98f74f1
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions README.md
@@ -1,38 +1,34 @@
### Trade aggregator
**Trade Aggregator Report**

Imagine you open a position and gradually add up to the working volume.
After reaching the desired price, you decide to close the position, also in parts.
In fact, it was one trade, but in the reports you will see several transactions at once.
Do you find yourself making trades in parts, gradually building up to your desired position? Perhaps, after reaching your target price, you decide to close your position in multiple chunks. In essence, it's a single trade, but when you check your reports, you see it as a series of transactions. That's where our Trade Aggregator Library comes into play.

This library aggregates transactions and displays:
This library efficiently aggregates these transactions, providing you with:

- complete trade report
- profit minus commission
- percentage of price movement
- the volume that was at the peak in dollars and coins
- A comprehensive trade report.
- Profit calculations, minus commission.
- The percentage movement in the asset's price.
- The peak volume in both dollars and coins.

### How to install
**Installation**

To get started, simply install the library with npm:

```bash
npm i crypto-trading-history
```

### How to use
**Usage**

Currently, only the Binance Futures crypto exchange is supported.
The data to be aggregated should be obtained from the API:
Currently, this library supports the Binance Futures crypto exchange. You'll need to obtain your trading data from the API endpoint:

```
GET /fapi/v1/userTrades
```

[Binance API Documentation](https://binance-docs.github.io/apidocs/futures/en/#account-trade-list-user_data)

In response, an array of objects will arrive, which should be fed to the `groupAggregatedTrades()`
function, the array will be sorted by coins and grouped by trades:
You will receive an array of objects in response. These need to be passed to the `groupAggregatedTrades()` function, which will sort and group the data by coins:

```json
// response from binance api
// Response from Binance API
[
{
"symbol": "NKNUSDT",
Expand Down Expand Up @@ -71,14 +67,16 @@ function, the array will be sorted by coins and grouped by trades:
]
```

Next, you can use the library as follows:

```js
const responseFromAPI = "...";
const responseFromAPI = "..."; // Replace with your API response
const rawTrades = JSON.parse(responseFromAPI);

const result = groupAggregatedTrades(rawTrades);
```

As a result, you will receive an aggregated report in a convenient format:
As a result, you'll receive an aggregated report in a user-friendly format:

```js
[
Expand All @@ -97,3 +95,5 @@ As a result, you will receive an aggregated report in a convenient format:
},
];
```

This library streamlines your trading data, making it easier to analyze and understand your trading performance.

0 comments on commit 98f74f1

Please sign in to comment.