{"id":16401740,"url":"https://github.com/mreiche/marketstack-python","last_synced_at":"2026-05-18T15:36:17.344Z","repository":{"id":62611171,"uuid":"560312685","full_name":"mreiche/marketstack-python","owner":"mreiche","description":"Python implementation of the marketstack API","archived":false,"fork":false,"pushed_at":"2022-11-09T10:13:47.000Z","size":191,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-27T08:51:28.748Z","etag":null,"topics":["marketstack","openapi","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mreiche.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}},"created_at":"2022-11-01T07:49:11.000Z","updated_at":"2023-10-08T21:25:39.000Z","dependencies_parsed_at":"2023-01-21T09:16:43.045Z","dependency_job_id":null,"html_url":"https://github.com/mreiche/marketstack-python","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/mreiche/marketstack-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mreiche%2Fmarketstack-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mreiche%2Fmarketstack-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mreiche%2Fmarketstack-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mreiche%2Fmarketstack-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mreiche","download_url":"https://codeload.github.com/mreiche/marketstack-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mreiche%2Fmarketstack-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33183131,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T09:27:30.708Z","status":"ssl_error","status_checked_at":"2026-05-18T09:27:28.300Z","response_time":71,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["marketstack","openapi","python"],"created_at":"2024-10-11T05:44:02.945Z","updated_at":"2026-05-18T15:36:17.326Z","avatar_url":"https://github.com/mreiche.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# marketstack-python\nInofficial Python OpenAPI implementation of the [marketstack API](https://marketstack.com/documentation) based on the [marketstack OpenAPI spec](https://github.com/mreiche/marketstack-openapi).\n\n![](https://img.shields.io/pypi/v/marketstack)\n\n## Usage\n\n### Configuration (recommended)\nSet up your API key and TLS support as ENV variables.\n```shell\nMARKETSTACK_API_KEY=\"xyz\"\nMARKETSTACK_TLS_SUPPORT=\"1\"\n```\n\n### Create your client\n\n```python\nfrom marketstack.client import Client\nimport os\n\ndef create_client() -\u003e tuple[Client, str]:  \n    access_key = os.getenv(\"MARKETSTACK_API_KEY\")\n    assert access_key is not None and len(access_key) \u003e 0, \"Environment variable MARKETSTACK_API_KEY is not defined\"\n\n    tls_support = os.getenv(\"MARKETSTACK_TLS_SUPPORT\")\n    protocol = \"https\" if tls_support == \"1\" else \"http\"\n    client = Client(base_url=f\"{protocol}://api.marketstack.com/v1\")\n    \n    return client, access_key \n```\n\n### Call operations\n\n```python\nfrom marketstack.api.eod import eod\n\nclient, access_key = create_client()\n\nresponse = eod.sync(\n    client=client,\n    access_key=access_key,\n    symbols=\"AAPL,AMZN\",\n    limit=10,\n)\n```\n\nAll endpoint features are implemented and tested. For examples see the repository's `tests/` directory.\n\n### Multiple asynchronous calls\n\n```python\nimport asyncio\nfrom typing import List\nfrom marketstack.api.intraday import intraday_latest\nfrom marketstack.api.exchanges import exchanges\nfrom marketstack.models import PagedResponseListmodelsIntervalPrice, PagedResponseListmodelsExchange\n\nasync def load_async(symbols: List[str]):\n   client, access_key = create_client()\n   \n   prices_call = intraday_latest.asyncio(access_key=access_key, client=client, symbols=\",\".join(symbols))\n   exchanges_call = exchanges.asyncio(access_key=access_key, client=client)\n   \n   # Type hints for future results\n   prices_response: PagedResponseListmodelsIntervalPrice\n   exchanges_response: PagedResponseListmodelsExchange\n   \n   prices_response, exchanges_response = await asyncio.gather(prices_call, exchanges_call)\n```\n\n\n### Error handling\n```python\nfrom marketstack.models import ErrorCode, ErrorResponse\n\nif isinstance(response, ErrorResponse):\n    assert response.error.code == ErrorCode.FUNCTION_ACCESS_RESTRICTED\n```\n\n### Map to Pandas dataframe\n```python\nimport pandas as pd\n\ndf = pd.DataFrame(map(lambda x: x.__dict__, response.data))\n```\n\n## Developers area\n\n### Generate the client\n1. Install the OpenAPI client generator\n   ```shell\n   pip install openapi-python-client\n   ```\n2. Regenerate the client\n   ```shell\n   ./regenerate.sh\n   ```\n\n### Run the tests\n\n1. Setup your marketstack API key in `tests/test.env`\n2. Run the tests via *pytest*\n   ```shell\n   PYTHONPATH=\".\" pytest --cov=marketstack tests/\n   ```\n\n### Release update\n1. Update version in `setup.py`\n2. Package library\n    ```shell\n    python setup.py sdist\n    ```\n3. Publish library\n    ```shell\n    twine upload dist/marketstack-[version].tar.gz\n    ```\n\n## References\n\n- https://github.com/MichaelKim0407/tutorial-pip-package\n- https://packaging.python.org/en/latest/guides/making-a-pypi-friendly-readme/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmreiche%2Fmarketstack-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmreiche%2Fmarketstack-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmreiche%2Fmarketstack-python/lists"}