Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
d8402dd
Update README.md
Jan 3, 2014
484c833
Updating docs.
stephan83 Jan 7, 2014
151db25
Tweaks
stephan83 Jan 8, 2014
c31230a
Node.js sample app
stephan83 Jan 8, 2014
95331cc
Tweak
stephan83 Jan 8, 2014
b9e7c89
tweak
stephan83 Jan 8, 2014
31c203b
Getting my groove on.
stephan83 Jan 8, 2014
f5e60b9
Tweaks
stephan83 Jan 8, 2014
b36e110
Tweak
stephan83 Jan 8, 2014
976a27b
Adding logo
stephan83 Jan 8, 2014
ae00bed
Tweak
stephan83 Jan 8, 2014
d29e021
typo
stephan83 Jan 8, 2014
be89c5a
typo
stephan83 Jan 8, 2014
a1cb9e3
Order types and states, tweaks
stephan83 Jan 9, 2014
8d608fb
typo
stephan83 Jan 9, 2014
e8c40d3
typo
stephan83 Jan 9, 2014
181c8d9
withdrawals
stephan83 Jan 9, 2014
6c87177
General docs
stephan83 Jan 9, 2014
5fb9ee7
Cleaned node.js example
stephan83 Jan 9, 2014
bbebc36
Node.js example
stephan83 Jan 9, 2014
d5c366d
Typo
stephan83 Jan 9, 2014
8c7bf85
uuid matching
stephan83 Jan 9, 2014
dafdbf5
made token file optional
stephan83 Jan 9, 2014
724a1dd
Added node.js example warning
stephan83 Jan 9, 2014
8921a5a
Added node.js errors
stephan83 Jan 9, 2014
386f1dc
bcjs bugfix
stephan83 Jan 9, 2014
c706d11
added basic encryption to bcjs example
stephan83 Jan 9, 2014
f9db038
bcjs example bugfix
stephan83 Jan 9, 2014
56a190d
bcjs example bugfix
stephan83 Jan 9, 2014
9789093
bcjs: new commands, confirmations
stephan83 Jan 14, 2014
a929f24
Fixes some mistakes in CURL urls.
stephan83 Feb 7, 2014
bff120b
Orders URL typo.
stephan83 Feb 10, 2014
3c80e73
Update on rate-limits and bitcoin charts endpoints
Feb 26, 2014
067da7a
Fuck you github
Feb 27, 2014
cd24055
Market orders
Mar 11, 2014
c00f81d
Added VWAP to ticker
Mar 12, 2014
4b7a7eb
Socket.io public stream.
stephan83 Mar 12, 2014
0259171
Merge branch 'master' of github.com:Paymium/api-documentation
stephan83 Mar 12, 2014
d42da83
Socket.io amount fix.
stephan83 Mar 12, 2014
36e0adb
merchant api
May 12, 2014
7de54b4
Review
May 15, 2014
704cc75
Payments
May 15, 2014
7940bbc
Payments
May 15, 2014
2d353cc
Payments
May 15, 2014
5160614
AutoRefreshToken link
May 26, 2014
9e21919
Add SNI mention
Jun 4, 2014
52538c9
btc addresses
Jun 12, 2014
eedcb9e
added scopes
Jun 13, 2014
8b7e98f
Merge branch 'addresses'
Jun 13, 2014
fb736fe
coquilles
Jun 13, 2014
e0aaae7
Bitcoin-Central -> Paymium
stephan83 Jul 1, 2014
83e05b9
Paymium logo.
stephan83 Jul 1, 2014
a89f245
coquilles
Jul 1, 2014
10209da
Bitcoin addresses
Jul 1, 2014
accece2
Starting token authentication documentation
Aug 8, 2014
31429b4
API token authentication documentation
Aug 8, 2014
d912219
Update image name
Aug 8, 2014
1aaf895
Bitcoin addresses and TXIDs in API responses
Aug 18, 2014
1e6c609
Recent API changes on authentication and callback signature
Aug 27, 2014
58e84e5
Merge branch 'master' of github.com:Paymium/api-documentation
Aug 28, 2014
9d67378
Recent API changes on authentication and callback signature
Aug 28, 2014
f554191
Updated examples endpoint.
stephan83 Sep 8, 2014
f6818a5
Typo
Oct 6, 2014
28c72ad
FIX API documentation
Oct 27, 2014
6508e9a
FIX Java connector example
Nov 4, 2014
56913e7
Added Python FIX connector example
Nov 7, 2014
4aa17dc
Removed useless heartbeat
Nov 7, 2014
d23bfb7
Update FIX-4.4.md
Nov 10, 2014
92318b3
Documentation update wrt Prestashop plugin
Dec 3, 2014
c783f24
Merge branch 'master' of github.com:Paymium/api-documentation
Dec 3, 2014
3e3bdcf
Documentation update
Jan 6, 2015
dd337b2
Doc update
Jan 15, 2015
b14863b
Update FIX docs
Jan 26, 2015
45141a5
Added sandbox environment
Mar 31, 2015
c8f5bc3
Incorrect method for invoice information method
Jun 9, 2015
27ab990
Start to add Email Transfer API endpoints
romainbou Jul 9, 2015
a279c9c
Add comments to email tranfers
romainbou Aug 10, 2015
bad976d
Update email transfer documentation
romainbou Aug 10, 2015
63ed071
Update table of contents
romainbou Aug 10, 2015
7294957
Add email transfer specitic properties and states
romainbou Aug 10, 2015
8c0b266
Correct curl example
Sep 7, 2015
e6760d8
remove trailing white spaces :scissors:
cyril Sep 25, 2015
0e0e475
add payment-request-by-email's documentation
cyril Sep 25, 2015
b3e673b
rename label into comment to keep things consistent
cyril Sep 29, 2015
2b73f2d
Merge pull request #1 from Paymium/feature/payment-request-by-email
cyril Oct 2, 2015
5b83205
Document websockets
Oct 20, 2015
0b3a598
JSON validity
Oct 20, 2015
a6f601b
JSON validity
Oct 20, 2015
b7c4857
Update public socket doc
stephan83 Oct 21, 2015
b36d73c
Private socket example
stephan83 Oct 21, 2015
0565d54
Update socket configuration doc
stephan83 Oct 21, 2015
0fe5078
Public and user socket examples
stephan83 Oct 21, 2015
ddc797a
notice event is public, not per user
stephan83 Oct 21, 2015
0201b08
WebSockets
Oct 21, 2015
f49294a
WebSockets
Oct 21, 2015
656baed
WebSockets
Oct 21, 2015
62b836f
Rephrase
Oct 21, 2015
4a84221
Rephrase
Oct 21, 2015
12a03c6
Price alerts
Oct 23, 2015
fc590b7
Update websockets doc
stephan83 Nov 2, 2015
15cc378
add 'since' param in to the trade action
cyril Nov 13, 2015
7b56f48
fix since example value
cyril Nov 13, 2015
3ba4c53
Extra payment state
davout Dec 10, 2015
932c981
Added countries end-point
davout Feb 9, 2016
2c2852c
Accepted flag for countries
davout Feb 9, 2016
e12331c
Quotes.
davout Feb 9, 2016
ae0b71b
update some pictures
Jun 28, 2016
447110f
Update README.md
kaderate Jun 28, 2016
edebd2f
Update README.md
kaderate Jan 9, 2017
7e2cf32
Update README.md
akettal Apr 26, 2018
43f7a08
Remove Fix Readme doc
Jan 15, 2019
0ff3c7e
Fix Typo
c0indev3l Apr 19, 2019
99d1bcb
Client fails to connect to the socket
Apr 19, 2019
61392ef
Add https to paymium public websocket
Jul 9, 2019
50b2812
Update README.md
jeromedcpaymium Sep 30, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,399 changes: 1,050 additions & 1,349 deletions README.md

Large diffs are not rendered by default.

274 changes: 274 additions & 0 deletions WEBSOCKETS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
# WebSocket API

* [Public socket](#public-socket)
* [Subscribing](#subscribing)
* [NodeJS example](#nodejs-example)
* [Public Data](#public-data)
* [publicData.ticker](#publicdataticker)
* [publicData.trades](#publicdatatrades)
* [publicData.bids](#publicdatabids)
* [publicData.asks](#publicdataasks)
* [User socket](#user-socket)
* [Subscribing](#subscribing-1)
* [NodeJS example](#nodejs-example-1)
* [User Data](#user-data)
* [userData.balance_eur](#userdatabalance_eur)
* [userData.locked_eur](#userdatalocked_eur)
* [userData.balance_btc](#userdatabalance_btc)
* [userData.locked_btc](#userdatalocked_btc)
* [userData.orders](#userdataorders)

Websockets are implemented using **socket.io v1.3**.

## Public socket

### Subscribing

You must connect your socket.io client to `paymium.com/public`, setting the path
option to `/ws/socket.io`. When new data is available, a `stream` event is
triggered.

### NodeJS example

```javascript
var io = require('socket.io-client');

var socket = io.connect('https://www.paymium.com/public', {
path: '/ws/socket.io'
});

console.log('CONNECTING');

socket.on('connect', function() {
console.log('CONNECTED');
console.log('WAITING FOR DATA...');
});

socket.on('disconnect', function() {
console.log('DISCONNECTED');
});

socket.on('stream', function(publicData) {
console.log('GOT DATA:');
console.log(publicData);
});
```

### Public data

The `stream` event will emit an object when new data is available. The object
will have properties **only for the data that changed**.

#### publicData.ticker

If the ticker changed, `publicData.ticker` will contains the new ticker
information.

Example:

```javascript
{
ticker: {
high: 275,
low: 275,
volume: 0.10909089,
bid: 205,
ask: 275,
midpoint: 240,
vwap: 275,
at: 1446464202,
price: 275,
open: 270,
variation: 1.8519,
currency: 'EUR',
trade_id: '460aff60-8fff-4fb0-8be5-2f8dc67758c2',
size: 0.03636363
}
}
```

#### publicData.trades

If new trades are executed, `publicData.trades` will be an array containing the
new trades.

Example:

```javascript
{
trades: [
{
price: 275,
traded_btc: 0.03636363,
timestamp: 1446464202000,
currency: 'EUR'
}
]
}
```

#### publicData.bids

If buy orders have changed (created, changed, or deleted), `publicData.bids`
will be an array containing the modified orders. Orders are aggregated by price.
If `amount` is `0`, there are no more orders at this price.

Example:

```javascript
{
bids: [
{
timestamp: 1424208720,
amount: 17.43992373,
price: 265,
currency: 'EUR',
category: 'buy'
}
]
}
```

#### publicData.asks

If sell orders have changed (created, changed, or deleted), `publicData.asks`
will be an array containing the modified orders. Orders are aggregated by price.
If `amount` is `0`, there are no more orders at this price.

Example:

```javascript
{
asks: [
{
timestamp: 1424208720,
amount: 17.43992373,
price: 275,
currency: 'EUR',
category: 'sell'
}
]
}
```

## User socket

### Subscribing

You must connect your socket.io client to `https://www.paymium.com/user`, setting the path
option to `/ws/socket.io`.

You must emit a `channel` event with the user channel id. This channel id is
available in the user's json (`/api/v1/user`).

When new data is available, a `stream` event is triggered.

### NodeJS example
```javascript
var io = require('socket.io-client');

var socket = io.connect('https://www.paymium.com/user', {
path: '/ws/socket.io'
});

console.log('CONNECTING');

socket.on('connect', function() {
console.log('CONNECTED');
console.log('WAITING FOR DATA...');
});

// Replace USER_CHANNEL_ID with the channel id of the user
socket.emit('channel', 'USER_CHANNEL_ID');

socket.on('disconnect', function() {
console.log('DISCONNECTED');
});

socket.on('stream', function(userData) {
console.log('GOT DATA:');
console.log(userData);
});
```

### User data

The `stream` event will emit an object when new data is available. The object
will have properties **only for the data that changed**.

#### userData.balance_eur

If the available EUR balance changed, `userData.balance_eur` will contain the
new balance.

```javascript
{
balance_eur: 410.04
}
```

#### userData.locked_eur

If the locked EUR balance changed, `userData.locked_eur` will contain the
new balance.

```javascript
{
locked_eur: 20.24
}
```

#### userData.balance_btc

If the available BTC balance changed, `userData.balance_btc` will contain the
new balance.

```javascript
{
balance_btc: 53.29811458
}
```

#### userData.locked_btc

If the locked BTC balance changed, `userData.locked_btc` will contain the
new balance.

```javascript
{
locked_btc: 0
}
```

#### userData.orders

If user orders have changed (created, filled, cancelled, etc...),
`userData.orders` will be an array containing the modified orders. You can check
the state of the orders to handle them properly.

Example:

```javascript
{
orders: [
{
uuid: '89d4b612-5e6a-4154-94f3-120d03f4e891',
amount: null,
currency_amount: 10,
state: 'pending_execution',
btc_fee: 0,
currency_fee: 0,
updated_at: '2015-11-02T11:36:41.000Z',
created_at: '2015-11-02T11:36:41.000Z',
currency: 'EUR',
comment: null,
type: 'MarketOrder',
traded_btc: 0,
traded_currency: 0,
direction: 'buy',
price: null,
account_operations: []
}
]
}
```
Loading