Skip to content
This repository has been archived by the owner on Mar 21, 2021. It is now read-only.

Commit

Permalink
remove buy/sell
Browse files Browse the repository at this point in the history
  • Loading branch information
pladaria committed Aug 25, 2017
1 parent e1d3011 commit 77dfc42
Show file tree
Hide file tree
Showing 6 changed files with 290 additions and 323 deletions.
57 changes: 21 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,62 +93,47 @@ degiro.getPortfolio().then(console.log);
// ...
```

### buy
### setOrder (buy/sell)

This example sets a permanent buy order 10 Apple shares at a fixed price of $110
This example sets a permanent buy order 10 Google shares at a fixed price of $900

```javascript
degiro.buy({
degiro.setOrder({
buysell: DeGiro.Actions.buy,
orderType: DeGiro.OrderTypes.limited,
productSymbol: 'AAPL',
productType: DeGiro.ProductTypes.shares,
productId: '8066561',
timeType: DeGiro.TimeTypes.permanent,
size: 10,
price: 110,
price: 900,
}).then(console.log); // prints the order id
```

#### Options
This example sets a sell order of 5 Google shares at market price

```javascript
degiro.setOrder({
buysell: DeGiro.Actions.sell,
orderType: DeGiro.OrderTypes.marketOrder,
productId: '8066561',
size: 15,
}).then(console.log); // prints the order id
```

#### Order options

- `orderType`: _number_
- DeGiro.OrderTypes.**limited**
- DeGiro.OrderTypes.**marketOrder**
- DeGiro.OrderTypes.**stopLoss**
- DeGiro.OrderTypes.**stopLimited**
- `productSymbol`: _string_
- `productType`: _number_
- DeGiro.ProductTypes.**shares**
- DeGiro.ProductTypes.**bonds**
- DeGiro.ProductTypes.**futures**
- DeGiro.ProductTypes.**options**
- DeGiro.ProductTypes.**investmendFunds**
- DeGiro.ProductTypes.**leveragedProducts**
- DeGiro.ProductTypes.**etfs**
- DeGiro.ProductTypes.**cfds**
- DeGiro.ProductTypes.**warrants**
- `productId`: _string_
- `timeType`: _number_
- DeGiro.TimeTypes.**day**
- DeGiro.TimeTypes.**permanent**
- `price`: _number_ - Required for `limited` and `stopLimited` orders
- `size`: _number_ - Order size
- `stopPrice`: _number_ - Required for `stopLoss` and `stopLimited` orders

### sell

This example sets a sell order of 15 Apple shares at market price

```javascript
degiro.sell({
orderType: DeGiro.OrderTypes.marketOrder,
productSymbol: 'AAPL',
productType: DeGiro.ProductTypes.shares,
size: 15,
}).then(console.log); // prints the order id
```

#### Options

Same options as `buy`.

### searchProduct

```javascript
Expand Down Expand Up @@ -183,7 +168,7 @@ degiro.searchProduct({text: 'GOOG'})).then(console.log);
*/
```

#### Options
#### Search options

- `text` _string_ - Search term. For example: "Netflix" or "NFLX"
- `productType` _number_ - See `DeGiro.ProductTypes`. Defaults to `all`
Expand Down
17 changes: 8 additions & 9 deletions examples/buy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ const degiro = DeGiro.create({
// password: 'your-password',
});

degiro.login().then(() => {
degiro.buy({
degiro.login().then(() =>
degiro.setOrder({
buysell: DeGiro.Actions.buy,
orderType: DeGiro.OrderTypes.limited,
productSymbol: 'AAPL',
productType: DeGiro.ProductTypes.shares,
timeType: DeGiro.TimeTypes.day,
productId: '8066561', // Google
timeType: DeGiro.TimeTypes.permanent,
size: 1,
price: 110,
price: 900,
})
.then(console.log)
.catch(console.error);
});
.then(console.log)
.catch(console.error));
16 changes: 7 additions & 9 deletions examples/sell.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ const degiro = DeGiro.create({
debug: true,
});

degiro.login().then(() => {
degiro.sell({
orderType: DeGiro.OrderTypes.limited,
productSymbol: 'AAPL',
productType: DeGiro.ProductTypes.shares,
size: 1,
price: 115,
degiro.login().then(() =>
degiro.setOrder({
buysell: DeGiro.Actions.sell,
orderType: DeGiro.OrderTypes.marketOrder,
productId: '8066561',
size: 15,
})
.then(console.log)
.catch(console.error);
});
.catch(console.error));
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
},
"dependencies": {
"cookie": "^0.3.1",
"eslint": "^4.1.0",
"lodash": "^4.16.4",
"node-fetch": "^1.6.3"
},
"devDependencies": {
"eslint": "^3.9.0",
"eslint": "^4.5.0",
"prettier": "^1.4.4"
},
"publishConfig": {
Expand Down
Loading

0 comments on commit 77dfc42

Please sign in to comment.