Skip to content

Commit

Permalink
Stock guarantees
Browse files Browse the repository at this point in the history
  • Loading branch information
Menighin committed May 13, 2021
1 parent 212d132 commit 20b67b4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ Resultado:
"totalValue": 2900
}
],
"stockGuaranteesWallet": [
{
"company": "BANCO INTER",
"stockType": "PN N2",
"code": "BIDI4",
"isin": "BRBIDIACNPR0",
"price": 11.43,
"quantity": 100,
"quotationFactor": 1,
"totalValue": 1143
}
],
"nationalTreasureWallet": []
},
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cei-crawler",
"version": "2.3.0",
"version": "2.4.0",
"description": "Crawler para pegar dados do Canal Eletronico do Investidor",
"main": "src/app.js",
"repository": {
Expand Down
8 changes: 4 additions & 4 deletions src/lib/WalletCrawler.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,14 @@ class WalletCrawler {

domPage(PAGE.SELECT_ACCOUNT).attr('value', account);

const { stockWallet, nationalTreasuryWallet } = await this._getDataPage(domPage, cookieManager, traceOperations);
const { stockWallet, stockGuaranteesWallet, nationalTreasuryWallet } = await this._getDataPage(domPage, cookieManager, traceOperations);

// Save the result
result.push({
institution: institution.label,
account: account,
stockWallet: stockWallet,
stockGuaranteesWallet: stockGuaranteesWallet,
nationalTreasuryWallet: nationalTreasuryWallet
});
}
Expand Down Expand Up @@ -301,15 +302,14 @@ class WalletCrawler {
if (traceOperations)
console.log(`Processing wallet data`);

const stockFreeWallet = this._processStockWallet(walletDOM, PAGE.STOCK_WALLET_TABLE_BODY_ROWS);
const stockWallet = this._processStockWallet(walletDOM, PAGE.STOCK_WALLET_TABLE_BODY_ROWS);
const stockGuaranteesWallet = this._processStockWallet(walletDOM, PAGE.STOCK_GUARANTEES_WALLET_TABLE_BODY_ROWS);
const stockWallet = stockFreeWallet.concat(stockGuaranteesWallet);

const nationalTreasuryWallet = this._processNationalTreasuryWallet(walletDOM);

if (errorMessage.type !== undefined || this._hasLoadedData(walletDOM)) {
return {
stockWallet,
stockGuaranteesWallet,
nationalTreasuryWallet
};
}
Expand Down

0 comments on commit 20b67b4

Please sign in to comment.