Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Futures order position tracking & FTX scaled collateral calculation #868

Merged
merged 49 commits into from
Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
a22be78
implements futures functions and GRPC functions on new branch
gloriousCode Jan 6, 2022
44d1780
lint and test fixes
gloriousCode Jan 7, 2022
4f19acc
Fix uneven split pnl. Adds collateral weight test. docs. New clear func
gloriousCode Jan 7, 2022
10cedd3
Test protection if someone has zero collateral
gloriousCode Jan 7, 2022
bc67a86
Uses string instead of double for accuracy
gloriousCode Jan 9, 2022
025452c
Fixes old code panic
gloriousCode Jan 9, 2022
d8bb688
context, match, docs
gloriousCode Jan 10, 2022
ac02d53
Addresses Shazniterinos, var names, expanded tests
gloriousCode Jan 11, 2022
bac9ce7
Returns subaccount name, provides USD values when offlinecalc
gloriousCode Jan 13, 2022
665fcc9
Fixes oopsie
gloriousCode Jan 13, 2022
406d3c2
Fixes cool bug which allowed made up subaccount results
gloriousCode Jan 13, 2022
8f76c78
Subaccount override on FTX, subaccount results for collateral
gloriousCode Jan 14, 2022
f276cff
Strenghten collateral account info checks. Improve FTX test
gloriousCode Jan 17, 2022
1d0d9e0
English is my first language
gloriousCode Jan 17, 2022
13b4878
Fixes oopsies
gloriousCode Jan 17, 2022
eb3bbb3
Merge branch 'master' into future-grpc
gloriousCode Jan 19, 2022
406f26c
Fixes for unrealised PNL & collateral rendering
gloriousCode Jan 28, 2022
b4c0ae8
Fixes lint and tests
gloriousCode Jan 28, 2022
df3bbf5
Shaznit fixes
gloriousCode Jan 31, 2022
295ac32
Secret Shaznit
gloriousCode Jan 31, 2022
406c485
Updates account information across wrappers to include more fields
gloriousCode Feb 1, 2022
59cfc0c
Updates online collateral calculations. Updates RPC data
gloriousCode Feb 2, 2022
50bd9e5
Accurately calculates collateral offline and online minus testing
gloriousCode Feb 2, 2022
9f4c443
Tests and lint chocolate
gloriousCode Feb 3, 2022
bc083af
Simplifies accountinfo results
gloriousCode Feb 3, 2022
ce34353
Fixes shaznits
gloriousCode Feb 3, 2022
d4e5b3a
Merge branch 'master' into future-grpc
gloriousCode Feb 17, 2022
7cb62cb
Adds new func
gloriousCode Feb 17, 2022
85d78ff
Increases collateral accuracy again again again x 200
gloriousCode Feb 18, 2022
45f4585
Increases accuracy of collateral rendering
gloriousCode Feb 21, 2022
3da4017
Merge branch 'master' into future-grpc
gloriousCode Feb 21, 2022
c6a951f
Fixes minor merge/test issues
gloriousCode Feb 21, 2022
1180e96
Linterino
gloriousCode Feb 21, 2022
84ad15e
Fixes ws test. Improves collateral calculations and rendering
gloriousCode Feb 23, 2022
8209696
Make it prettier
gloriousCode Feb 23, 2022
f692f1c
Removes the lock I put on :eyes:
gloriousCode Feb 23, 2022
16e145f
Adds `additional_collateral_used` field, renders orig currency
gloriousCode Feb 25, 2022
0d4b413
Fixes unrelated test
gloriousCode Feb 25, 2022
948b680
Fix test
gloriousCode Feb 25, 2022
8a8e173
Correctly calculate spot margin borrow collateral
gloriousCode Feb 25, 2022
9dd2a8d
Address fun lint surprise
gloriousCode Feb 28, 2022
c109172
Strange lint fixing x2
gloriousCode Feb 28, 2022
b0b7cb5
Continued lint journey
gloriousCode Feb 28, 2022
a27effb
Nolint the nolint to not lint the lint
gloriousCode Feb 28, 2022
bc6d6a0
Adds two new fields to response
gloriousCode Feb 28, 2022
94fbd40
More linting issues arising
gloriousCode Feb 28, 2022
3f5fff3
fIX3s_c4s|NG
gloriousCode Feb 28, 2022
dd5e5a2
Fixes command flags' incorrect numbering
gloriousCode Feb 28, 2022
bd73beb
FairMarket = Won
gloriousCode Feb 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
run:
timeout: 3m
timeout: 6m
issues-exit-code: 1
tests: true
skip-dirs:
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ thrasher- | https://github.com/thrasher-
shazbert | https://github.com/shazbert
gloriousCode | https://github.com/gloriousCode
dependabot-preview[bot] | https://github.com/apps/dependabot-preview
xtda | https://github.com/xtda
dependabot[bot] | https://github.com/apps/dependabot
xtda | https://github.com/xtda
lrascao | https://github.com/lrascao
Rots | https://github.com/Rots
vazha | https://github.com/vazha
ydm | https://github.com/ydm
ermalguni | https://github.com/ermalguni
MadCozBadd | https://github.com/MadCozBadd
ydm | https://github.com/ydm
vadimzhukck | https://github.com/vadimzhukck
140am | https://github.com/140am
marcofranssen | https://github.com/marcofranssen
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014-2021 The GoCryptoTrader Developers
Copyright (c) 2014-2022 The GoCryptoTrader Developers

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,18 @@ Binaries will be published once the codebase reaches a stable condition.

|User|Contribution Amount|
|--|--|
| [thrasher-](https://github.com/thrasher-) | 660 |
| [shazbert](https://github.com/shazbert) | 226 |
| [gloriousCode](https://github.com/gloriousCode) | 191 |
| [thrasher-](https://github.com/thrasher-) | 662 |
| [shazbert](https://github.com/shazbert) | 231 |
| [gloriousCode](https://github.com/gloriousCode) | 194 |
| [dependabot-preview[bot]](https://github.com/apps/dependabot-preview) | 88 |
| [dependabot[bot]](https://github.com/apps/dependabot) | 50 |
| [xtda](https://github.com/xtda) | 47 |
| [dependabot[bot]](https://github.com/apps/dependabot) | 29 |
| [lrascao](https://github.com/lrascao) | 15 |
| [lrascao](https://github.com/lrascao) | 21 |
| [Rots](https://github.com/Rots) | 15 |
| [vazha](https://github.com/vazha) | 15 |
| [ydm](https://github.com/ydm) | 15 |
| [ermalguni](https://github.com/ermalguni) | 14 |
| [MadCozBadd](https://github.com/MadCozBadd) | 13 |
| [ydm](https://github.com/ydm) | 13 |
| [vadimzhukck](https://github.com/vadimzhukck) | 10 |
| [140am](https://github.com/140am) | 8 |
| [marcofranssen](https://github.com/marcofranssen) | 8 |
Expand Down
4 changes: 2 additions & 2 deletions backtester/eventhandlers/exchange/exchange_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ func TestPlaceOrder(t *testing.T) {
}
f := &fill.Fill{}
_, err = e.placeOrder(context.Background(), decimal.NewFromInt(1), decimal.NewFromInt(1), false, true, f, bot.OrderManager)
if err != nil && err.Error() != "order exchange name must be specified" {
t.Error(err)
if !errors.Is(err, engine.ErrExchangeNameIsEmpty) {
t.Errorf("received: %v, expected: %v", err, engine.ErrExchangeNameIsEmpty)
}

f.Exchange = testExchange
Expand Down
4 changes: 3 additions & 1 deletion cmd/apichecker/apicheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,9 @@ loop:
}
}
}
resp = resp[:1]
if len(resp) > 1 {
resp = resp[:1]
}
return resp, nil
}

Expand Down
1 change: 1 addition & 0 deletions cmd/documentation/engine_templates/order_manager.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
+ The order manager subsystem stores and monitors all orders from enabled exchanges with API keys and `authenticatedSupport` enabled
+ It can be enabled or disabled via runtime command `-ordermanager=false` and defaults to true
+ All orders placed via GoCryptoTrader will be added to the order manager store
+ Any futures based order will be tracked via the [futures positions controller](/exchanges/order/README.md) which can be used to track PNL. Use GRPC command [getfuturesposition](https://api.gocryptotrader.app/#gocryptotrader_getfuturesposition) to view position data for an exchange, asset, pair

### Please click GoDocs chevron above to view current GoDoc information for this package
{{template "contributions"}}
Expand Down
4 changes: 3 additions & 1 deletion cmd/documentation/exchanges_templates/orders.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{define "exchanges orders" -}}
{{define "exchanges order" -}}
{{template "header" .}}
## Current Features for {{.Name}}

Expand All @@ -7,6 +7,8 @@
- Deletion of order
- Order tracking

+ For futures orders, this package also contains a futures position controller. It is responsible for tracking all futures orders that GoCryptoTrader processes. It keeps a running history of realised and unreaslied PNL to allow a trader to track their profits. Positions are closed once the exposure reaches zero, then upon a new futures order being processed, a new position is created. To view futures positions, see the GRPC command `getfuturesposition`

### Please click GoDocs chevron above to view current GoDoc information for this package
{{template "contributions"}}
{{template "donations" .}}
Expand Down
Loading