Skip to content

Commit c1e14ab

Browse files
committed
Fixed buy sell order requests
1 parent 17b6046 commit c1e14ab

File tree

5 files changed

+8
-11
lines changed

5 files changed

+8
-11
lines changed

server/api/portfolio/portfolio.service.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@ class PortfolioService {
110110
'Accept-Language': 'en;q=1, fr;q=0.9, de;q=0.8, ja;q=0.7, nl;q=0.6, it;q=0.5',
111111
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
112112
'Connection': 'keep-alive',
113-
'X-Robinhood-API-Version': '1.152.0',
114-
'User-Agent': 'Robinhood/5.32.0 (com.robinhood.release.Robinhood; build:3814; iOS 10.3.3)',
115-
'Authorization': `Token ${token}`
113+
'Authorization': `Bearer ${token}`
116114
};
117115

118116
console.log('Sell order: ',{
@@ -155,9 +153,7 @@ class PortfolioService {
155153
'Accept-Language': 'en;q=1, fr;q=0.9, de;q=0.8, ja;q=0.7, nl;q=0.6, it;q=0.5',
156154
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
157155
'Connection': 'keep-alive',
158-
'X-Robinhood-API-Version': '1.152.0',
159-
'User-Agent': 'Robinhood/5.32.0 (com.robinhood.release.Robinhood; build:3814; iOS 10.3.3)',
160-
'Authorization': `Token ${token}`
156+
'Authorization': `Bearer ${token}`
161157
};
162158

163159
console.log('Buy order: ', {

server/routes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ module.exports = function(app) {
1313

1414
app.route('/*')
1515
.get(function(req, res) {
16-
res.sendfile(app.get('appPath') + '/index.html');
16+
res.sendfile('dist/index.html');
1717
});
1818
};

src/app/shared/account.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export interface Account {
22
unsettled_funds?: number;
33
uncleared_deposits?: number;
44
unsettled_debit?: number;
5-
url?: string;
5+
account?: string;
66
cash?: number;
77
cash_held_for_orders?: number;
88
buying_power?: number;

src/app/shared/services/authentication.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ export class AuthenticationService {
6666

6767
return this.http.get('/api/portfolio', options)
6868
.map((response: Response) => {
69-
this.myAccount = response.json().results[0];
69+
const account = response.json().results;
70+
this.myAccount = account[account.length - 1];
7071
return this.myAccount;
7172
});
7273
}

src/app/shared/services/portfolio.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class PortfolioService {
3636
const headers = new Headers({ 'Authorization': 'Bearer ' + this.authenticationService.token });
3737
const options = new RequestOptions({ headers: headers });
3838
const body = {
39-
'account': this.authenticationService.myAccount.url,
39+
'account': this.authenticationService.myAccount.account,
4040
'url': holding.instrument,
4141
'symbol': holding.symbol,
4242
'quantity': quantity,
@@ -60,7 +60,7 @@ export class PortfolioService {
6060
const headers = new Headers({ 'Authorization': 'Bearer ' + this.authenticationService.token });
6161
const options = new RequestOptions({ headers: headers });
6262
const body = {
63-
'account': this.authenticationService.myAccount.url,
63+
'account': this.authenticationService.myAccount.account,
6464
'url': holding.instrument,
6565
'symbol': holding.symbol,
6666
'quantity': quantity,

0 commit comments

Comments
 (0)