Comments (14)
thanks for fast response! just say the market goes up, and i want a new higher stop loss on my existing position?
from xapi-node.
Hi,
on new position (limit or market execution will be the same) you have to set "sl" parameter to the exact price like 1.07 for EURUSD or something like that.
x.Socket.send.tradeTransaction({
cmd: CMD_FIELD.BUY_LIMIT,
customComment: null,
expiration: new Date().getTime() + 60000 * 60 * 24 * 365,
offset: 0,
order: 0,
price: 21900,
sl: 21000, // Here for example
symbol: 'US30',
tp: 26500,
type: TYPE_FIELD.OPEN,// for Modifying this will be => "TYPE_FIELD.MODIFY"
volume: 0.2
}).then(({order}) => {
console.log('Success ' + order);
}).catch(e => {
console.error('Failed');
console.error(e);
});
for modifying will be the same but you have to change "order" parameter to order id.
You can find this function docs in WS how it works: https://peterszombati.github.io/xapi-node/#tradeTransaction
from xapi-node.
oh ok. just set the orderId and the rest as is..
I'll try that.
thanks heaps :)
from xapi-node.
in 2.3.1 I made simplier trade modifying you can try it.
x.Socket.send.tradeTransaction({
order: 1234, // order / position number you can find it in (x.positions)
type:TYPE_FIELD.MODIFY,
sl:1.0 // add only what you want to modify
})
from xapi-node.
looks perfect, thanks heaps.
from xapi-node.
from xapi-node.
Hi @bda2206
problem will be "price" : 0
did you set it for it or module when added missing parameters?
are you sure did you use 2.3.1?
from xapi-node.
from xapi-node.
@bda2206 I added two log error in 2.3.2 which can describe if it not adding missing parameters why this do it
if (type === TYPE_FIELD.MODIFY && position === undefined) {
if (!this.XAPI.isSubscribeTrades) {
Log.error('type === MODIFY in tradeTransaction will not work with missing parameters and subscribeTrades = false, you should set subscribeTrades = true in login config');
} else {
Log.error('type === MODIFY in tradeTransaction orderId = ' + order + ' not found, possible orderIds: ' + this.XAPI.positions.map(p => p.position).join(','))
}
}
from xapi-node.
from xapi-node.
@bda2206 Try update to 2.3.3 with npm install xapi-node
and the problem is tradeTransaction request params required all params cmd, price, etc but xapi-node try to fill all missing params if it can't do it will be throw an Error and why it is not possible (in 2.3.3)
from xapi-node.
from xapi-node.
I dont see your image
from xapi-node.
from xapi-node.
Related Issues (20)
- Stream commands not working in demo HOT 3
- How to get current trades HOT 1
- Tick prices showing up multiple times HOT 1
- getCandles listener never gets triggered HOT 3
- x.Stream.subscribe.getCandles bug (caused by xOpenHub server side logic) HOT 12
- x.getPriceHistory Data limit potentially exceeded HOT 1
- Missing Documentation for getPriceHistory HOT 1
- Replace dependecy Logger4 with Winston HOT 11
- Invalid parameters when close or delete position HOT 1
- parseStack.js:10 Uncaught ReferenceError: process is not defined HOT 3
- Publish the npm package as UMD
- streamSessionId available from login? HOT 2
- Issue with closing STC positions on XTB HOT 2
- issue with node 18 HOT 2
- getCommissionDef HOT 1
- [question] getPriceHistory "start" parametters HOT 2
- [feature] getAllSymbols HOT 4
- This actually does not work on frontend. HOT 4
- GetTickPrices stream hang up HOT 5
- XAPIConfig change, type -> accountType HOT 1
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 xapi-node.