Skip to main content

This is a API wrapper for NEPSE API.

Project description

NEPSE API Wrapper

This python module fetches the data from Nepali Stock Site and provides them in a pythonic and usable way.

About

This is a API wrapper for NEPSE API. This project was inspired from PyPi Nepse.

Documentation

There is a detailed guide in my documentation page for getting started and installing. Documentation

How to use?

You can use this by package from Nepse API PyPi

pip install nepse-api

Why use this?

How is this better than PyPi Nepse?

  • It is asynchronous.
  • Data can be taken as attributes rather than from dict.
  • Data is fetched from the API rather than scraping the site.
  • Data is cached

APIs used

The APIs that I used to create this API wrapper is:

How to use?

import asyncio
import httpx
from nepse import Client


async def main():
    company_Symbol = input('Input Company Symbol (Uppercase): ')

    # Doing this is optional you can directly
    # Initialize using `client = Client()` as well
    async with httpx.AsyncClient() as async_client:
        # Initializes the client
        client = Client(httpx_client=async_client)

        # Gets the data
        data = await client.security_client.get_company(symbol=f"{company_Symbol}")

        # Prints the highest price for that company today
        print(f'High Price of {company_Symbol}: ', data.high_price)
        print(f'Low price of {company_Symbol}: ', data.low_price)
        print(f'Open Price of {company_Symbol}: ', data.open_price)

# Run the function
loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Why are the attributes so in-costistent?

The attribues are in-consistent because the attributes are set according to the response set by the API. I tried changing it up but that would be distruptive because the comability with the API would be broken.

Want To Contribute?

You can send a pull request or open an issue to contribute. Check out Code Of Conduct before contributing.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nepse-api-1.1.5a0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

nepse_api-1.1.5a0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file nepse-api-1.1.5a0.tar.gz.

File metadata

  • Download URL: nepse-api-1.1.5a0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.9.5 Linux/5.12.6-arch1-1

File hashes

Hashes for nepse-api-1.1.5a0.tar.gz
Algorithm Hash digest
SHA256 7dfcc1923019f15a65f05c289ecc25407db2a36d19938a4c98bd234d218f5636
MD5 b4665dcb52fab10545ffd1dc9a5a215a
BLAKE2b-256 699864aca78a2355cfdbc87614a554b4b060c51b8522e82ba6b6d71a012a7bcf

See more details on using hashes here.

File details

Details for the file nepse_api-1.1.5a0-py3-none-any.whl.

File metadata

  • Download URL: nepse_api-1.1.5a0-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.9.5 Linux/5.12.6-arch1-1

File hashes

Hashes for nepse_api-1.1.5a0-py3-none-any.whl
Algorithm Hash digest
SHA256 40ad39050027b1e23db98fb2127d3aa9a6538bde1dcc9ee109fc3a5b635f8ee0
MD5 acf167ed06d37c58723a6d7f0f7b5218
BLAKE2b-256 b823f5f8e54e5c17a8581ff97cfb4a9c61beb802b06b237827817b973aef59c4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page