Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

How Copy Trade One Account To Multiple accounts ? #140

Open
safebinarybot opened this issue Sep 29, 2019 · 1 comment
Open

How Copy Trade One Account To Multiple accounts ? #140

safebinarybot opened this issue Sep 29, 2019 · 1 comment

Comments

@safebinarybot
Copy link

safebinarybot commented Sep 29, 2019

function subscribeToTransactions() {
api.events.on('transactions', function(response) {
console.log(response);
});
api.subscribeToTransactions();
}

I used this method ,
with this i can get if trade placed
but i want to copy that same trade to multiple account using Tokens

@martinov @raitucarp @borisyankov @raunakkathuria @aminroosta @gokula-krishna-dev

@wilburforce83
Copy link

I don't think you can do it using the api, but you can just do it in JS. Put your tokens in an array and run an Array.forEach on the trade.

Pull the parameters from the subscription and add to you paramters var

const tokenArray = ["list", "you" "account", "tokens"];

api.events.on('transactions', function(response) {
// you'll need to filter the response and add correct details in the parameter const below
  const tradingParameters = {
        amount: amountVar,
        basis: 'stake',
        contract_type: callorPutorAnythingallowedVar
        currency: yourFIATcurrency,
        duration: durationVar,
        duration_unit: unitVar,
        symbol: symbolVar,
    };

  console.log("Placing trade");

  placeTrade(tokenArray,tradingParameters);

});


function placeTrade(arr, parameters) {

   arr.forEach(token) {

      api.authorize(token).then(function (response) {

      api.buyContractParams(parameters, 2500);

      });
   };
};

I haven't tested this but it should work

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants