Git Product home page Git Product logo

blinktradejs's People

Contributors

cesardeazevedo avatar elias19r avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blinktradejs's Issues

Not working with create-react-app

I am trying to use the sdk in a pwa app created with create-react-app, but I'm getting those errors after yarn add blinktrade

The version installed of the sdk is 0.0.7

Error in ./~/blinktrade/lib/util/stun.js
Module not found: 'dgram' in /media/dados/workspace/pwa-experiment/node_modules/blinktrade/lib/util

 @ ./~/blinktrade/lib/util/stun.js 37:13-29

Error in ./~/macaddress/lib/windows.js
Module not found: 'child_process' in /media/dados/workspace/pwa-experiment/node_modules/macaddress/lib

 @ ./~/macaddress/lib/windows.js 1:11-35

Error in ./~/macaddress/lib/linux.js
Module not found: 'child_process' in /media/dados/workspace/pwa-experiment/node_modules/macaddress/lib

 @ ./~/macaddress/lib/linux.js 1:11-35

Error in ./~/macaddress/lib/unix.js
Module not found: 'child_process' in /media/dados/workspace/pwa-experiment/node_modules/macaddress/lib

 @ ./~/macaddress/lib/unix.js 1:11-35

Balance requests always return SyntaxError in JSON

When I run the code below to request the balance,
blinktrade.balance({ MsgType: "U2", BalanceReqID: 1 }).then(function(balance) { console.log(balance); });

I always receive the following error message:
SyntaxError: Unexpected token ? in JSON at position 0

Also, the request only does NOT return the error below after a few tries (normally 'works' on second try):
> Error: Error: U2 Not authorized at BlinkTradeWS.onMessage (C:\Users\.....\blinktrade\lib\wsTransport.js:164:15) at WebSocket.onMessage (C:\Users\.....\ws\lib\EventTarget.js:99:16) at emitOne (events.js:116:13) at WebSocket.emit (events.js:211:7) at Receiver._receiver.onmessage (C:\Users\.....\ws\lib\WebSocket.js:141:47) at Receiver.dataMessage (C:\Users\.....\ws\lib\Receiver.js:389:14) at Receiver.getData (C:\Users\.....\ws\lib\Receiver.js:330:12) at Receiver.startLoop (C:\Users\.....\ws\lib\Receiver.js:165:16 ) at Receiver.add (C:\Users\.....\ws\lib\Receiver.js:139:10) at TLSSocket._ultron.on (C:\Users\.....\ws\lib\WebSocket.js:138:22)

But that isn't the trouble. Even when I get past it, I can't find a way to read (balance).
Is there a way I can remove the "?" ? Some method? Something I'm missing?
By the way, I'm running the code on Node.js. Could it have something to do with it?
I don't think so, but who knows?
I don't recall doing anything different than the examples given in the docs.
Every other kind of request or operation I did worked. The account at hand has zero balance and is in the testnet.

Thanks.
Sorry people. I found a way to make balance work. I still don't understand very well how everything happened, but all is fine now.

Cancel failure over websocket

Hi,

How are we supposed to catch cancel failures ?
In the docs the standard OrderCancelReject is not documented, is it sent ?

Thx

Public REST API returning Content-Type: text/html

The server is returning header Content-Type: text/html instead of Content-Type: application/json for Ticker and Trades public REST API.

See:

curl --head 'https://api.blinktrade.com/api/v1/BRL/ticker'
curl --head 'https://api.blinktrade.com/api/v1/BRL/trades'

No `Latency` in `heartbeat()` callback

The .Latency in the heartbeat callback is undefined unlike the .Latency in the promise

            blinktrade.heartbeat()
                .then(function(beat) {
                    console.log(beat.Latency); //=> this returns the latency in ms
                });

            blinktrade.heartbeat(function(err, beat) {
                    console.log(beat.Latency); //=> this returns `undefined`
                });

Confirmation Withdraw

Hello

When I make a withdrawal request through WebSocket it asks me for the secondFactor since I have activated it in my account, and for Rest it sends me an email with a code to confirm.
There is no way you do not need any code to confirm the withdrawals, as an example in other exchanges that if they enable the API service they do not need confirmation?

[Question] Error Too many messages per second

I've been receiving the following error a lot:
Error: 16 messages in the last second Too many messages per second

Could you please explain a bit more of this issue? Is my application sending more than 16 messages per second (which is not happening based on my tests) or the server is trying to send me all this messages?
How can I avoid this issue?

`onWithdrawRefresh()` doesn't work

The code that watches state change of withdrawals never executes, but the watcher for the specific withdrawals does.

// this doesn't ever execute
blinktrade.onWithdrawRefresh(function(withdraw) {
  console.log(withdraw);
});

// this works for `new` and `cancelled` withdrawals
blinktrade.requestWithdraw({
    "amount": parseInt(1200 * 1e8),
    "currency": "PKR",
    "method": "BankIslami",
    "data": {
        "AccountName": "A Girl Is No One",
        "AccountNumber": "123477",
    }
}).on('WITHDRAW_REFRESH', function(withdraw) {
    console.log(withdraw);
});

How to know rejection reasons?

Hello again!
I am still testing things and another problem comes out: there is no documentation about rejection reasons. I am trying to blinktrade.sendOrder() with no success.
This is the returned message:

{ 
  OrderID: null,
  Volume: 0,
  ExecID: null,
  ExecType: '8',
  OrdStatus: '8',
  LeavesQty: 0,
  Price: 371930000000,
  OrderQty: 369265,
  LastShares: 0,
  LastPx: 0,
  CxlQty: 0,
  TimeInForce: '1',
  CumQty: 0,
  MsgType: '8',
  ClOrdID: 9667187,
  OrdType: '2',
  OrdRejReason: '3',
  Side: '1',
  Symbol: 'BTCBRL',
  ExecSide: '1',
  AvgPx: 0
}

How to know what OrdRejReason: '3' means?

TakerTransactionFeeBuy value

Hello,

For exemple Vbtc returns TakerTransactionFeeBuy: 25
By how much should I divide to get the percentage between 0 and 1 ? in other words, actual fee is 0.025 or 0.0025 ?

Thank you

How do I fetch order by OrderId?

Hello, I've noticed that the execution report doesn't seem to show the settlement price, e.g.:

{ OrderID: 1459146238526, 
  ExecID: 566318, 
  ExecType: '2', 
  OrdStatus: '2', 
  CumQty: 1254716, 
  Symbol: 'BTCPKR', 
  OrderQty: 1254716, 
  LastShares: 1254716, 
  LastPx: 7851100000000, 
  Price: 100000000, 
  TimeInForce: '1', 
  LeavesQty: 0, 
  MsgType: '8', 
  ExecSide: '2', 
  OrdType: '2', 
  CxlQty: 0, 
  Side: '2', 
  ClOrdID: 4743461, 
  AvgPx: 7851100000000 } 

Is there anyway for me to lookup a specific order status by OrderID? The current myOrders method returns a list of orders, and it's paginated by 40 orders each. I can't use that since if over 40 of my orders are executed near simultaneously, the list will not contain them.

Post only orders

Hi,

Can I ensure I do post only ?
Currently I send TimeInForce='P' but I do see fees on VBTC which is supposed to have no maker fees.

Thank you

Trade api sendOrder creates the orders but response of promise don't comes.

Hi,

Because I can't use the testnet platform I trying some tests in production.

I guess when I'm create the order the promise should responds with OrdStatus: New, but nothing hapens.

My order enter in the order book but my code doesn't receive any response or errors it simple stucks.

opera instantaneo_2017-10-27_023152_foxbit exchange

Follow the section of the code:

const BlinkTradeWS = require("blinktrade").BlinkTradeWS;
  let prod = true
  let blinktrade = new BlinkTradeWS({ prod: prod });
//
// I'm abreviated the code to
//... connect ...
//.. login
//..

let options = { 
  msgType: 'D',
  side: '2', //sell
  price: (30000 * 1e8).toFixed(0), //R$ 30000
  amount: (0.0001 * 1e8).toFixed(0), // 0.0001
  brokerID: '4', //foxbit
  symbol: 'BTCBRL',
  ordType: '2', // limited
  clOrdID: '1' 
}

 blinktrade.sendOrder(options).then(function(order) {
           console.log(order); // this code doesn't executes
       }).catch(function(...args){
           console.log(args); //this code doesn't executes too
       });

`

Getting error using BlinkTradeJS in new node application

Hi Guys,

I'm testing the API.

In a new node application:

npm init
npm install blinktrade

Then when running this code:

var BlinkTradeWS = require('blinktrade').BlinkTradeWS;

var blinktrade = new BlinkTradeWS();

blinktrade.connect().then(function() {
  return blinktrade.login({ username: 'rodrigo', password: 'abc12345' });
}).then(function(logged) {
  console.log(logged);
}).catch(function(err) {
  console.log(err);
});

Get this error:

throw new Error('Error: ' + data.Detail + ' ' + data.Description);
        ^
Error: Error: Missing tag BrokerID Invalid message
at WebSocketTransport.onMessage (.../blockchain/blinktrade_examples/node_modules/blinktrade/lib/transpo
rts/websocket.js:156:15)
    at WebSocket.onMessage (.../blinktrade_examples/node_modules/ws/lib/EventTarget.js:99:16)
    at WebSocket.emit (events.js:160:13)

If I try execute any code in node_modules/examples folder, run correctly!

Could you have any advices about this ?

Thanks

Know if a trade has been done as taker

Hi,

Is the AggressorIndicator flag present in the report when a fill happen ?
If not how can I know if the trade was done as a taker or a maker ?

Thx

Cannot convert undefined or null to object

Hello all,
I am calling blinktrade.balance() and this error is thrown:

TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at /home/uli/Projetos/blinktrade_tests/node_modules/blinktrade/lib/baseTransport.js:91:18
    at process._tickCallback (internal/process/next_tick.js:109:7)

Anyone else having this problem? Is this an error in the SDK or I am just missing something?

MSG_LOGIN_ERROR_INVALID_USERNAME_OR_PASSWORD

Hi.
Im experiencing some problems trying to login with WS, returning MSG_LOGIN_ERROR_INVALID_USERNAME_OR_PASSWORD. The strange thing is, minutes after this error, I'll look at my API keys registered, and its no-more available!
My impression is that after some failed attempts, the KEY is removed.

Can you help?
(Of course I'm using a valid API key, it was working fine until today.)
Response:
{"Username": "APIKEY***", "NeedSecondFactor": false, "UserStatusText": "MSG_LOGIN_ERROR_INVALID_USERNAME_OR_PASSWORD", "SecondFactorType": null, "UserReqID": 1530032211, "UserStatus": 3, "MsgType": "BF"}

EDIT
My mistake, closing...

Make REST API Stable

I totally understand this isn't a priority for you guys so I'm only creating this to be notified when the API becomes stable.

Since there's only a stable nodejs client for the websockets API, I'm using it to create an HTTP API service for my internal use and would love to know when the stable API is out so that I can switch to it.

Please close this issue whenever the REST endpoints become stable ๐Ÿ‘

Wrong fiat balance

The REST API seem to be returning the wrong fiat balance.
Currently I have 0 BRL and 0 BTC at FoxBit (4), but when asking the REST API for my balance:

let BlinkTradeRest = require('blinktrade').BlinkTradeRest;

let rest = new BlinkTradeRest({
  prod: true,
  key: 'mykey',
  secret: 'mysecret',
  currency: 'BRL',
  brokerId: 4
});

rest.balance().then(function(balance) {
  console.log(balance);
});

I get this:

{ '4': { BTC_locked: 0, BRL: 233915, BTC: 0, BRL_locked: 0 },
  MsgType: 'U3',
  ClientID: 123456,
  BalanceReqID: 123456,
  Available: { BRL: 233915, BTC: 0 } }

233915 BRL! Am I richer than I thought?! ๐Ÿ˜›

New API info

Hi, is there some news about new Foxbit API for multiple currencies?
Can you give us an feedback?
Thanks

Server error 500 shows SQLite error message

I managed to get a server error 500 while canceling an order using BlinkTradeRest.cancelOrder() and got a SQLite message of the error in the Description field instead of a user-friendly message.

Example:

let BlinkTradeRest = require("blinktrade").BlinkTradeRest;

let blinktrade = new BlinkTradeRest({
    prod: true,
    key: MY_KEY,
    secret: MY_SECRET,
    currency: "BRL"
});

blinktrade.cancelOrder({
    orderID: 0, clientId: 0 // or null, undefined, []
})
.then((order) => {
    console.log(order);
})
.catch((err) => {
    console.error(err);
});

Include example of WITHDRAW_REFRESH

Hello

Can you please provide an example of WITHDRAW_REFRESH

  • Does this event fire upon both a pending and successful withdrawal?
  • Is the schema different for BTC and FIAT?
  • Is the schema different for different brokers?

Making an app, only pieces left to automate are trading and withdrawals ๐Ÿ˜„

subscribeToOrderbook returning undefined values (WebSocket API)

I receive callbacks from the subscription, but It returns orders with undefined values, so it's impossible to update my orderbook.

Examples:
delete Order: { index: 3,
price: NaN,
size: NaN,
side: 'sell',
userId: undefined,
orderId: undefined,
symbol: 'BTCBRL',
time: 'Invalid Date',
type: 'OB:DELETE_ORDER' }

delete order thru: { index: 1,
price: NaN,
size: NaN,
side: 'buy',
userId: undefined,
orderId: undefined,
symbol: 'BTCBRL',
time: 'Invalid Date',
type: 'OB:DELETE_ORDERS_THRU' }

[Question] ExecutionReport not working

Hi guys,

i'm trying to subscribe into ExecutionReport from your WS API but the callbacks never return any response, even if i go to the exchange site and perform the operations manually. I'm wondering if it is a new issue or it is something related to my particullar broker (Foxbit).

The package version being used is: 0.1.0-beta.4 (Latest)

Do you know if there is other users with the same issue?

Just for peace of mind, below you can find sample code extracted from my original source.

If you need any other information, let me know. I really apreciatte any relevant information about the topic. Thanks in advance.

import { BlinkTradeWS , BlinkTradeRest } from "blinktrade";

export class FoxbotConfig
{
    userName : string = 'SUPER_SECRET_TOKEN';
    password : string = 'TOKEN_PASSWORD';
    symbol : string =  'BTCBRL';
    brokerId: number = 4;
}

export class Foxbot
{    
    private blinktrade : any;
    private loginInfo : any;

    constructor(private _config : FoxbotConfig)
    {
        this.blinktrade = new BlinkTradeWS({ 
            prod: true , 
            brokerId : _config.brokerId  
        });

        this.loginInfo = { 
            username: this._config.userName, 
            password: this._config.password , 
            brokerId : _config.brokerId 
        };
    }

    public Start()
    {
        // Opens WS API Connection
        this.blinktrade.connect()
        // Logs In the exchange 
        .then(x => { return this.blinktrade.login(this.loginInfo) })
        .then(info => { console.log(info) })
        // Start sending HeartBeats to keep connection alive
        .then(x => { this.HeartBeat(); })
        // Execute Test Operations
        .then(x => { this.Test() })
        // Catch any error if it occurs
        .catch(err => 
        { 
            console.log('Error:');
            console.log(err);
        });
    }

    public Test()
    {
        this.blinktrade.executionReport()
        .on("EXECUTION_REPORT:NEW", o => { console.log(1); })
        .on("EXECUTION_REPORT:PARTIAL", o => { console.log(2); })
        .on("EXECUTION_REPORT:EXECUTION", o => { console.log(3); })
        .on("EXECUTION_REPORT:CANCELED", o => { console.log(4); })
        .on("EXECUTION_REPORT:REJECTED", o => { console.log(5); });

        setTimeout(() => {

            console.log('CREATING BUY ORDER');
            this.CreateBuyOrder(1000, 0.001 , true).then(x =>
            {
                console.log('BUY ORDER CREATED')
                this.CancelOrder(x['OrderID'] , x['ClOrdID'])
                .then(y => { console.log('BUY ORDER CANCELLED') });
            });
    
        }, 3000);

        setTimeout(() => {
            
            console.log('CREATING SELL ORDER');
            this.CreateSellOrder(100000, 0.001 , true).then(x =>
            {
                console.log('SELL ORDER CREATED')
                this.CancelOrder(x['OrderID'] , x['ClOrdID'])
                .then(y => { console.log('SELL ORDER CANCELLED') });
            });

        }, 6000);
    }

    private HeartBeat()
    { 
        let i = setInterval( x => { 
            console.log('HEART BEAT ...');
            this.blinktrade.heartbeat(); 
        }  , 5000);
    }

    // Creates an BUY Order
    private CreateBuyOrder(reais: number , btc : number, isRealValue : boolean = false)
    {
        let x = parseInt((isRealValue ?  reais * 1e8 : reais ).toFixed(0));
        let y = parseInt((isRealValue ? btc * 1e8 : btc).toFixed(0));
        
        return this.blinktrade.sendOrder({
        "side": "1",
        "price": x,
        "amount": y,
        "symbol": this._config.symbol
        });
    }

    // Creates an SELL Order
    private CreateSellOrder(reais: number , btc : number , isRealValue : boolean = false)
    {
        let x = parseInt((isRealValue ? reais * 1e8 : reais).toFixed(0));
        let y = parseInt((isRealValue ?  btc * 1e8 : btc).toFixed(0));

        return this.blinktrade.sendOrder({
        "side": "2",
        "price": x,
        "amount": y,
        "symbol": this._config.symbol
        });
    }

    private CancelOrder(orderId:number , orderClientId)
    {
        let x = { orderID: orderId, clientId: orderClientId }
        return this.blinktrade.cancelOrder(x);
    }
}

// ------------------------------------------------------------------------------
let bot = new Foxbot(new FoxbotConfig());
bot.Start();

Minor: `.sendOrder` only accepts Integer amounts

This is a minor annoyance and nothing more. Please feel free to close this and any of my requests that you don't agree with under a won't fix label :)

Typing this:

blinktrade.sendOrder({
    "side": "2", // Sell
    "price": parseInt(1 * 1e8), // 1 PKR
    "amount": "519153",
    "symbol": "BTCPKR",
})

Will result in the following error:

Error: Error: Invalid value tag(OrderQty)=519153 Invalid message
    at BlinkTradeWS.onMessage (/Users/gilani/Sandbox/payload-urdubit/node_modules/blinktrade/lib/wsTransport.js:165:15)
    at WebSocket.onMessage (/Users/gilani/Sandbox/payload-urdubit/node_modules/ws/lib/WebSocket.js:442:14)
    at emitTwo (events.js:106:13)
    at WebSocket.emit (events.js:191:7)
    at Receiver.ontext (/Users/gilani/Sandbox/payload-urdubit/node_modules/ws/lib/WebSocket.js:841:10)
    at /Users/gilani/Sandbox/payload-urdubit/node_modules/ws/lib/Receiver.js:536:18
    at Receiver.applyExtensions (/Users/gilani/Sandbox/payload-urdubit/node_modules/ws/lib/Receiver.js:371:5)
    at /Users/gilani/Sandbox/payload-urdubit/node_modules/ws/lib/Receiver.js:508:14
    at Receiver.flush (/Users/gilani/Sandbox/payload-urdubit/node_modules/ws/lib/Receiver.js:347:3)

Because the API expects a strict integer. However, typing the following will work:

blinktrade.sendOrder({
    "side": "2", // Sell
    "price": parseInt(1 * 1e8), // 1 PKR
    "amount": parseInt("519153"),
    "symbol": "BTCPKR",
})

Deposit - REST not working

The requestDeposit function is not working in the BlinkTradeRest API.

The follow response is returned:
{ Status: 500,
Description: 'Not possible to generate a deposit address at this time. Please try again later.',
Result: {} }

UnhandledPromiseRejectionWarning: Unhandled promise rejection

blinktrade.connect().then(function() {
	return blinktrade.login({ username: config.key, password: config.password });
}).then(function(logged) {
	console.log("Connected BlinkTradeWS")
})

My node is v8.9.4 and npm 5.6.0, and I am using the latest version of BlinkTrade, when I was running the code, i got the error as shown below.

(node:9502) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): undefined
(node:9502) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

REST Api returning Wrong Value

I'm using the REST Api with C++ application that I`m developing, but the rest API is returning the wrong value.
For example, if I request this url "https://api.blinktrade.com/api/v1/BRL/ticker?crypto_currency=BTC" I receive this response:
{"high": 64800.0, "vol": 1626.534244, "buy": 54800.11, "last": 54800.1, "low": 49000.0, "pair": "BTCBRL", "sell": 54849.99, "vol_brl": 95239499.81959416}.
But, if I enter on foxbit website, the cotation is between 49999 and 50000.
The same happens with the order book.
What is wrong?

BE not authorized

Hi guys,

i'm running a program using your api and eventually i get an error with the message "BE not authorized". I really don't know what the error means, cause the message doesn't say to much about the root cause (At least to me ). Do you know anything about? I could just write some code to retry/restart the the process, but a really want to know if i'm doing something wrong related to the api usage instead write a lot more code to just "workaround" the situation.

Thanks in advance.

Add documentation on rate limit

I just hit Error: 16 messages in the last second Too many messages per second this should totally be included in the documentation ;)

Balance call fails

Hi,

Since today, when i call balance it fails with

{ FetchError: invalid json response body at https://api.blinktrade.com/tapi/v1/message reason: Unexpected token < in JSON at position 0
    at /Users/matthieuachard/Documents/bitcoin/arnaud-bitcoin-trader/node_modules/node-fetch/lib/body.js:48:31
    at process._tickDomainCallback (internal/process/next_tick.js:135:7)
  name: 'FetchError',
  message: 'invalid json response body at https://api.blinktrade.com/tapi/v1/message reason: Unexpected token < in JSON at position 0',
  type: 'invalid-json' }

Any idea ?

withdraw from API key

Maybe something is wrong with BTC withdrawals from websocket API.
My test was done with Python and testnet (https://testnet.blinktrade.com/).
API key / pass / secret was created with user "user" with password described in home page.
After successful logon in websocket with message "BE" / "BF", I send "B6" message:

{"MsgType": "U6", "WithdrawReqID": 314, "Method": "bitcoin", "Amount": 100086099, "Currency": "BTC", "Data": {"Wallet": "173D1zQQyzvCCCek9b1SpDvh7JikBEdtRJ", "Memo": "Testnet saque BTC"}}

API always answer with "Not Authorized" message:

{"Request": {"Origin": "https://testnet.blinktrade.com", "GatewayID": "demo-1:ws_gateway_8443", "Currency": "BTC", "Amount": 100086099, "RemoteIP": "<sanitized_IPV6>", "WithdrawReqID": 314, "Data": {"Wallet": "173D1zQQyzvCCCek9b1SpDvh7JikBEdtRJ", "Memo": "Testnet saque BTC"}, "Method": "bitcoin"}, "MsgType": "ERROR", "Description": "Not authorized", "Detail": "U6"}

Thanks in advance!

Invalid broker

I'm trying to connect via websocket to see data from froxbit (BROKER ID = 4) but I'm facing an error:
image

What happened? I looked at blinktrade docs and I saw the Foxbit name with a scratched...
image

Did something happen with foxbit api? thanks for your help

Unhandled error: ENOTFOUND stunserver.org

A script that was working perfectly before just started throwing errors.

$ node index.js
events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo ENOTFOUND stunserver.org
    at errnoException (dns.js:27:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:78:26)

The index.js file only contains the following lines:

// Setup BlinkTrade
var BlinkTrade = require('blinktrade');
var BlinkTradeWS = BlinkTrade.BlinkTradeWS;
var blinktrade = new BlinkTradeWS({
    prod: true
});

Response No JSON object could be decoded

Hello guys, I am trying to make a request, but I have not had any success, I always send my fix in Json format but I always get the same answer, how can I solve this?

The small code is written in php using the laravel framework 5.4.3

    $nonce = strval(time());
    $signature = hash_hmac("sha256", $nonce, $this->secret); 
    $array = [
        "MsgType" => "U2",
        "BalanceReqID" => 1,
    ];
    $message = json_encode($array);
    $client = new \GuzzleHttp\Client(array( "curl" => array(CURLOPT_SSL_VERIFYPEER => false)));
    $response = $client->request(
                "POST", "https://api.testnet.blinktrade.com/tapi/v1/message", [
                    'headers' => [
                        "User-Agent" => "testing/1.0",
                        "Content-Type"     => "application/json",
                        "Nonce"      => $nonce,
                        "Signature" => $signature,
                        "APIKey" => $this->key
                    ]
                ],  $message

    );
    $response = json_decode($response->getBody()->getContents());
    return  response()->json($response);   

Thank you very much for your help

WebSocket API not working

I am trying generate new btc deposit address but its giving me error.
What I am doing wrong ?
Thanks

bl
bl1

Add Access-Control-Allow-Origin to response headers

I'm building an web app that consumes BTC prices from exchanges from Brazil. Since I don't need everything inside blinktrade package and browsers need things lean and slim, I'd like to make a simple XHR cross domain request to fetch ticker prices. The problem is Access-Control-Allow-Origin response header is missing, throwing an error in the console:

Failed to load https://api.blinktrade.com/api/v1/BRL/ticker: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

Do you have plans to support this header on public API responses?

Websocket disconnects me sometimes

Hi,

it seems like the websocket disconnects me when the rate of the commands i send is too high.
However I remain under the documented limit (12 instead of 16)
Or is it because of something else ?

Thx

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.