spotware / openapi-proto-messages Goto Github PK
View Code? Open in Web Editor NEWOpen API Proto Messages
Home Page: https://openapi.ctrader.com
License: MIT License
Open API Proto Messages
Home Page: https://openapi.ctrader.com
License: MIT License
Hello,
at https://spotware.github.io/open-api-docs/profit-loss-calculation/
the following pseudo code is indicated to calculate rate for converting P&L to deposit currency
fromAsset = "JPY"
toAsset = "USD"
// rate will be our conversion result
rate = 1
// symbols are the ProtoOASymbolsForConversionRes symbols field
symbols[] = ProtoOASymbolsForConversionRes(fromAsset,toAsset)
asset = fromAsset
FOR symbol in symbols:
IF symbol.baseAsset == asset:
rate = rate * symbol.price
asset = symbol.quoteAsset
ELSE:
rate = rate * 1 / symbol.price
asset = symbol.baseAsset
However from the pseudo code indicated it's not clear to me if symbol.price
represents the bid price or the ask price of the symbol? I should consider it the ask price since I'm supposed to buy the deposit currency with the symbol quote asset?
For now this is my solution but I'm not 100% sure if it's totally correct.
fromAsset = "JPY"
toAsset = "USD"
// rate will be our conversion result
rate = 1
// symbols are the ProtoOASymbolsForConversionRes symbols field
symbols[] = ProtoOASymbolsForConversionRes(fromAsset,toAsset)
asset = fromAsset
FOR symbol in symbols:
IF positionDirection == SHORT:
closePrice = symbol.ask
ELSE:
closePrice = symbol.bid
IF symbol.baseAsset == asset:
rate = rate * closePrice
asset = symbol.quoteAsset
ELSE:
rate = rate * 1 / closePrice
asset = symbol.baseAsset
Hello there,
following my tests on Open API I would suggest:
Some ambigous circumstances:
Just some suggestions. I understand that your API already provides the fundamental functionalities to operate in markets.
I'm creating a framework for operating with NodeJS which uses Open API under the hood: I'm glad to contribute if you need me.
Thank you for publishing the updated protobuf structure. What about updating also the Node.js usage examples?
Regards,
Vasile.
The last tag is 80 and the different from master is just documentation and the Go package configuration at the proto files, which I need. It's possible to release a new tag?
Since you have introduced ProtoOADealListByPositionIdReq
I would suggest creating also a ProtoOAOrderListByPositionIdReq
which would allow reconstructing the entire life cycle of a position without the need to make deep search and perform many requests to ProtoOAOrderListReq
.
I would also suggest a ProtoOAPositionHistoryReq
which should return all the the position orders, deals, swaps... all information about a position. This will avoid sending 5-10 requests to different ProtoOA methods for composing the whole situtation of a position.
Whad do you think?
Thank you for your great job ๐
It would be great to have the following interfaces
OrderListByPositionIdReq
DealListByPositionIdReq
ย
DealListByOrderIdReq
ย
This would avoid sending multiple OrderListReq
and DealListReq
requests to your servers to link positions, orders and deals.
The documentation at https://spotware.github.io/open-api-docs/protocol-buffers/
says using
demo.ctraderapi.com:5035 for demo accounts
and live.ctraderapi.com:5035 for live accounts.
But meanhile my application submission gets approved, can you provide a clientId and clientSecret to test the API? With accountId and token as well.
Regards,
Vasile.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.