Skip to content

Commit

Permalink
Add README
Browse files Browse the repository at this point in the history
  • Loading branch information
Tpessia committed Jul 11, 2024
1 parent e22200a commit f922182
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repository:
name: dados-financeiros
description: Repositório de Fontes de Dados Financeiros
topics: finance, stock-market, market-data, brasil, financial-data
# homepage: https://example.com # TODO: add website
homepage: https://InvestTester.com/api
private: false
has_issues: true
has_wiki: false
Expand Down
4 changes: 3 additions & 1 deletion api/.semgrep.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
rules:
- id: hardcoded-api-key
pattern-regex: '(?i)\b(api[\._-]?)?(key|token|secret|password|pass|passwd|pswd|auth|credentials)[=\s][0-9a-zA-Z+/=]{6,64}\b'
pattern-either:
- pattern-regex: '(?i)\b(api[\._-]?)?(key|token|secret|password|pass|passwd|pswd|auth|credentials)[=:][0-9a-zA-Z+/=]{6,64}\b'
- pattern-regex: '(?i)\b[0-9a-zA-Z]{30,}\b'
message: "Potential API key or token detected"
languages: [generic]
severity: ERROR
Expand Down
1 change: 1 addition & 0 deletions api/.semgrepignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ vendor/
*.min.js
.npm/
.yarn/
package-lock.json

# Common test paths
test/
Expand Down
19 changes: 13 additions & 6 deletions api/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# Centralizador de Dados Financeiros
# Financial Data API

Esta aplicação é uma API que centraliza dados financeiros, com foco nos dados disponíveis no [repositório dados-financeiros](https://github.com/Tpessia/dados-financeiros).
API that centralizes financial data, focusing on the data available in the [financial data repository](https://github.com/Tpessia/dados-financeiros).

## Funcionalidades
## Features

- Busca de dados financeiros por códigos de ativos.
- Suporte para diferentes tipos de ativos, incluindo taxas de juros, índices de inflação, ações e moedas.
- Conversão e alavancagem de dados conforme especificado nos códigos dos ativos.
- Financial data search by asset codes.
- Support for different types of assets, including interest rates, inflation indices, stocks, and currencies.
- Data conversion and leveraging as specified in the asset codes.

## Docker

```
npm run docker:build
npm run docker:run
```
2 changes: 1 addition & 1 deletion api/src/@utils/data/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function sortByNumber<T>(array: T[], selector: (e: T) => any = e => e) {
return array.sort((a, b) => (selector(a) || 0) - (selector(b) || 0));
}

export function numDictToArray<T>(dict: {[key:number]: T}) {
export function numDictToArray<T>(dict: {[key: number]: T}) {
return (Object.entries(dict) as any as [number, T][]).reduce((acc, val) => {
acc[val[0]] = val[1];
return acc;
Expand Down
18 changes: 11 additions & 7 deletions api/src/scheduler/services/scheduler.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@ export class SchedulerService {
constructor(private moduleRef: ModuleRef) {}

async run(...services: DataSource[]) {
if (!services?.length) services = Object.keys(this.services) as DataSource[];
this.logger.log(`Running jobs: ${services.join(', ')}`);
const funcs = Object.entries(this.services)
.filter(job => services.includes(job[0] as DataSource))
.map(job => () => this.runService(job[1]));
await promiseParallelAll(funcs, 2);
this.logger.log(`Finished jobs (${funcs.length})`);
try {
if (!services?.length) services = Object.keys(this.services) as DataSource[];
this.logger.log(`Running jobs: ${services.join(', ')}`);
const funcs = Object.entries(this.services)
.filter(job => services.includes(job[0] as DataSource))
.map(job => () => this.runService(job[1]));
await promiseParallelAll(funcs, 2);
this.logger.log(`Finished jobs (${funcs.length})`);
} catch (err) {
this.logger.error(err.toString(), err.stack);
}
}

async start() {
Expand Down

0 comments on commit f922182

Please sign in to comment.