Skip to content

Commit 6a29d6b

Browse files
authored
Merge pull request #42 from nash-io/add-affilate-code
support affiliate codes
2 parents a094c46 + ccf4a04 commit 6a29d6b

File tree

10 files changed

+1931
-427
lines changed

10 files changed

+1931
-427
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
<a name="5.2.7"></a>
6+
## [5.2.7](https://github.com/nash-io/api-client-typescript/compare/v5.2.5...v5.2.7) (2020-09-03)
7+
8+
9+
510
<a name="5.2.5"></a>
611
## [5.2.5](https://github.com/nash-io/api-client-typescript/compare/v5.2.3...v5.2.5) (2020-08-22)
712

README.md

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
Official TypeScript client for interacting with the [Nash Exchange](https://nash.io/).
44

55
- [Github repository](https://github.com/nash-io/api-client-typescript)
6-
- [Documentation](https://nash-io.github.io/api-client-typescript)
7-
6+
- [Documentation](https://nash-io.github.io/api-client-typescript)
87

98
To test your integrations, Nash provides a public sandbox environment at https://app.sandbox.nash.io.
109

@@ -69,36 +68,34 @@ run()
6968

7069
## Nodejs usage
7170

72-
Using the client in node can be done like below. See also the [nodejs example](https://github.com/nash-io/api-client-typescript/tree/master/examples/nodejs).
71+
Using the client in node can be done like below. See also the [nodejs example](https://github.com/nash-io/api-client-typescript/tree/master/examples/nodejs).
7372

7473
```javascript
75-
76-
const Nash = require('@neon-exchange/api-client-typescript');
74+
const Nash = require('@neon-exchange/api-client-typescript')
7775

7876
const client = new Nash.Client(Nash.EnvironmentConfiguration.production)
7977

8078
const apiKeys = {
81-
"secret": "your secret",
82-
"apiKey": "your key"
79+
secret: 'your secret',
80+
apiKey: 'your key'
8381
}
8482

8583
const run = async () => {
8684
try {
8785
await client.login(apiKeys)
8886
} catch (e) {
89-
console.log(e);
87+
console.log(e)
9088
}
9189
}
9290

9391
run()
94-
9592
```
9693

9794
## Websockets
9895

9996
You can use websockets subscriptions like this:
10097

101-
```typescript
98+
```javascript
10299

103100
import { Client, EnvironmentConfiguration } from '@neon-exchange/api-client-typescript'
104101

@@ -133,9 +130,27 @@ nash.subscriptions.onUpdatedAccountOrders(
133130
}
134131
}
135132
)
136-
133+
137134
```
138135

136+
## Using affiliate codes
137+
138+
To configure the client to use an affiliate code, you just have to supply it as a client option.
139+
140+
```javascript
141+
import { Client } from '@neon-exchange/api-client-typescript'
142+
143+
const client = new Client(
144+
...,
145+
{
146+
affiliateCode: 'YOUR_CODE',
147+
affiliateLabel: 'arbitragebot' // Optional label
148+
}
149+
)
150+
```
151+
152+
You may supply an optional affiliate label, which will be shown on the affiliate page. Label may only contain alpha numeric characters.
153+
139154
---
140155

141156
## Setting up API keys
@@ -154,21 +169,20 @@ Whitelisted addresses can be set up both before and after creating the API key.
154169

155170
## State signing
156171

157-
In order to assure your blockchain balances remain in sync with your trading balances, the client must 'sign' their state every so often before placing more orders. By default, the client will take care of this in the background for you and you will not need to worry about this.
172+
In order to assure your blockchain balances remain in sync with your trading balances, the client must 'sign' their state every so often before placing more orders. By default, the client will take care of this in the background for you and you will not need to worry about this.
158173

159-
In special cases where a user has more than one client process running at once which is placing a high volume of orders, it is advisable to take a more custom approach. To turn of auto state syncing, initialize the client like so:
174+
In special cases where a user has more than one client process running at once which is placing a high volume of orders, it is advisable to take a more custom approach. To turn of auto state syncing, initialize the client like so:
160175

161176
```
162177
const nash = new Client(EnvironmentConfiguration.sandbox, {autoSignState: false})
163178
```
164179

165-
You will then be responsible for signing states when necessary. The current restriction is that states must be signed every 100 open orders, so the client should keep track and make sure to sign state before this limit is reached, otherwise placing an order will raise an error.
180+
You will then be responsible for signing states when necessary. The current restriction is that states must be signed every 100 open orders, so the client should keep track and make sure to sign state before this limit is reached, otherwise placing an order will raise an error.
166181

167-
This is done using the following call:
182+
This is done using the following call:
168183

169184
```
170185
const states = await client.getSignAndSyncStates()
171186
```
172187

173188
If you are running a high volume of orders from different clients on the same account and having difficulty managing this process, please reach out to support and we will be glad to help with an optimal solution.
174-

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@neon-exchange/api-client-typescript",
3-
"version": "5.2.5",
3+
"version": "5.2.7",
44
"description": "Official TypeScript client for interacting with the Nash exchange",
55
"main": "build/main/index.js",
66
"typings": "build/main/index.d.ts",

0 commit comments

Comments
 (0)