{"id":20102856,"url":"https://github.com/artdevgame/stock-bot-api","last_synced_at":"2025-09-03T07:46:07.943Z","repository":{"id":179634356,"uuid":"339371163","full_name":"artdevgame/stock-bot-api","owner":"artdevgame","description":"Retrieve info related to dividend stocks.","archived":false,"fork":false,"pushed_at":"2021-03-11T18:48:30.000Z","size":72,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-13T04:29:57.356Z","etag":null,"topics":["api","graphql","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/artdevgame.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-16T11:07:03.000Z","updated_at":"2024-03-14T23:09:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"9436a016-98ce-4d79-8e6f-516221bc50a0","html_url":"https://github.com/artdevgame/stock-bot-api","commit_stats":null,"previous_names":["artdevgame/stock-bot-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artdevgame%2Fstock-bot-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artdevgame%2Fstock-bot-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artdevgame%2Fstock-bot-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artdevgame%2Fstock-bot-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artdevgame","download_url":"https://codeload.github.com/artdevgame/stock-bot-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241542229,"owners_count":19979278,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","graphql","typescript"],"created_at":"2024-11-13T17:33:19.394Z","updated_at":"2025-03-02T17:22:29.414Z","avatar_url":"https://github.com/artdevgame.png","language":"TypeScript","readme":"# stock-bot-api\n\nRetrieve info related to dividend stocks.\n\n\u003e You might also be interested in: [`stock-bot`](https://github.com/artdevgame/stock-bot)\n\n## Requirements\n\n- Docker\n- Node.js (only tested against `v14`)\n- Yarn\n\n## Setup\n\nTo get started, run: `docker-compose up`, which will start a Redis instance and Fastify + GraphQL server.\n\n## Usage\n\nTo retrieve a dividend, you must first acquire an instrument to query against.\n\nAll requests must be [authenticated](#authentication)\n\n### Retrieve an instrument with an ISIN\n\n\u003csmall\u003eRequest\u003c/small\u003e\n\n```\ncurl --location --request POST 'http://localhost:3000/graphql' \\\n--header 'x-api-key: [YOUR API KEY]' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n    \"query\": \"query { fetchInstrumentWithIsin(isin: \\\"US5949181045\\\") { id } }\"\n}'\n```\n\n\u003csmall\u003eResponse\u003c/small\u003e\n\n```\n{\n    \"data\": {\n        \"fetchInstrumentWithIsin\": {\n            \"id\": \"17ae97b6-94cc-5543-b671-b862b1a6d5b7\"\n        }\n    }\n}\n```\n\n### Retrieve an instrument with a stock symbol (ticker)\n\n\u003csmall\u003eRequest\u003c/small\u003e\n\n```\ncurl --location --request POST 'http://localhost:3000/graphql' \\\n--header 'x-api-key: [YOUR API KEY]' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n    \"query\": \"query { fetchInstrumentWithSymbol(symbol: \\\"MSFT\\\") { id } }\"\n}'\n```\n\n\u003csmall\u003eResponse\u003c/small\u003e\n\n```\n{\n    \"data\": {\n        \"fetchInstrumentWithSymbol\": {\n            \"id\": \"17ae97b6-94cc-5543-b671-b862b1a6d5b7\"\n        }\n    }\n}\n```\n\nNow that you have an instrument, you can use this to retrieve a dividend\n\n### Retrieve a dividend\n\n\u003csmall\u003eRequest\u003c/small\u003e\n\n```\ncurl --location --request POST 'http://localhost:3000/graphql' \\\n--header 'x-api-key: c7dd7869-d701-4259-8d36-18dd295ebb49' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n    \"query\": \"query { fetchDividend(id: \\\"17ae97b6-94cc-5543-b671-b862b1a6d5b7\\\"){ dividendYield } }\"\n}'\n```\n\n\u003csmall\u003eResponse\u003c/small\u003e\n\n```\n{\n    \"data\": {\n        \"fetchDividend\": {\n            \"dividendYield\": 0.009189\n        }\n    }\n}\n```\n\n## \u003ca name=\"authentication\"\u003e\u003c/a\u003e Authentication\n\nAn API key is used as an anonymous way to rate limit the service.\n\nIn order to generate API keys, you must set a value in the config under the `server.authKey` property.\n\nOnce this value is set, API keys can be generated using the following request:\n\n```\ncurl --location --request POST 'http://localhost:3000/api/key-store' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n    \"authKey\": \"[YOUR server.authKey VALUE]\"\n}'\n```\n\n\u003csmall\u003eResponse\u003c/small\u003e\n\n```\n{\n    \"created\": \"2021-02-25T11:01:52.189Z\",\n    \"isBanned\": false,\n    \"key\": \"47ccf4d9-1ff8-453a-8286-5a96d7f842c3\",\n    \"lastUsed\": \"2021-02-25T11:01:52.189Z\"\n}\n```\n\n## Rate Limits\n\nIf a consumer makes more requests than the `server.apiLimit.maxRequestsPerMinute` value in the config (default: 300), they will receive a HTTP 429 response.\n\nIf the consumer continues to make requests whilst limited, and exceeds the `server.apiLimit.banAfterMaxHttp429Responses` value in the config (default: 30), the API key will be banned and the response code will be HTTP 409.\n\n## Integration Tests\n\nRun `yarn test:integration` from the Fastify container to test the suppliers are working as expected.\n\n## Future development tasks\n\n- Break dividend cache\n- Config option to allow supplier preference for stock yield\n- Add dividend payout ratio\n- Add dividend next payment date\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartdevgame%2Fstock-bot-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartdevgame%2Fstock-bot-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartdevgame%2Fstock-bot-api/lists"}