Comments (3)
Hi, I added BuyLong and SellLong (previously Buy and Sell) and BuyShort and SellShort. The last two methods I implemented only for Binance.
Here is the code:
public override TradingResult BuyLong(AccountInfo account, Ticker ticker, double rate, double amount) {
return MakeTrade(account, ticker, rate, amount, "BUY", "LONG");
}
public override TradingResult BuyShort(AccountInfo account, Ticker ticker, double rate, double amount) {
return MakeTrade(account, ticker, rate, amount, "BUY", "SHORT");
}
public override TradingResult SellShort(AccountInfo account, Ticker ticker, double rate, double amount) {
return MakeTrade(account, ticker, rate, amount, "SELL", "SHORT");
}
public override TradingResult SellLong(AccountInfo account, Ticker ticker, double rate, double amount) {
return MakeTrade(account, ticker, rate, amount, "SELL", "LONG");
}
protected TradingResult MakeTrade(AccountInfo account, Ticker ticker, double rate, double amount, string side, string positionSide) {
string queryString = string.Format("symbol={0}&side={1}&positionSide={2}&quantity={3:0.########}&price={4:0.########}×tamp={5}&type=LIMIT&timeInForce=GTC&recvWindow=5000",
ticker.Name, side, positionSide, amount, rate, GetNonce());
string signature = account.GetSign(queryString);
string address = string.Format("https://api.binance.com/api/v3/order?{0}&signature={1}",
queryString, signature);
MyWebClient client = GetWebClient();
client.Headers.Clear();
client.Headers.Add("X-MBX-APIKEY", account.ApiKey);
try {
return OnTradeResult(account, ticker, client.UploadValues(address, new HttpRequestParamsCollection()));
}
catch(Exception e) {
LogManager.Default.Log(e.ToString());
return null;
}
}
I implement them according this documentation: https://binance-docs.github.io/apidocs/futures/en/#new-order-trade
from cryptotradingframework.
Thank you. I have a look. There is a lack of futures module on the whole. For example, the front desk has only the spot part, but there is no futures market part, including the account is also the spot account
from cryptotradingframework.
I see... Well, currently I am busy with another project (which is, honesty, more preferrable, because one pays me for that). I'll implement this functionality when I have time. Currently you can do it by your own, it is not so difficult. Please take a look at binancemodule.cs and try to implement similar functionality using this documentation.
from cryptotradingframework.
Related Issues (10)
- getting invalid rex file and The designer could not be shown for this file because none of the classes within it can be designed. HOT 1
- Unable to run the project. HOT 1
- Why are you using devexpress? HOT 14
- Can't find WebApplication1.csproj file HOT 1
- Create a fresh release so we able to use as we don't have compiler for some reason HOT 4
- About add Futures module HOT 6
- dose this project help you make any mony? HOT 2
- please add this dex exchange
- unable to run the project. HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cryptotradingframework.