semvec/pypi-packages huggingface dataset:
backtest 0.7.8
Backtest engine for algorithmic trading
Requires Python: >=3.9
Keywords: backtest algotrading

# Backtest

[![Python version](https://img.shields.io/pypi/pyversions/backtest.svg)](https://pypi.org/project/backtest/)
[![PyPI version](https://img.shields.io/pypi/v/backtest.svg)](https://pypi.org/project/backtest/)
[![Test](https://github.com/yoonbae81/backtest/workflows/test/badge.svg)](https://github.com/yoonbae81/backtest/actions?query=workflow%3Atest)
[![Build](https://github.com/yoonbae81/backtest/workflows/build/badge.svg)](https://github.com/yoonbae81/backtest/actions?query=workflow%3Abuild)
[![Coverage](https://codecov.io/gh/yoonbae81/backtest/graph/badge.svg)](http://codecov.io/gh/yoonbae81/backtest)
[![Docs](https://readthedocs.org/projects/backtest/badge/?version=latest)](https://backtest.readthedocs.io/latest)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)

A [backtest](https://en.wikipedia.org/wiki/Backtesting) engine for developing [algorithmic trading](https://en.wikipedia.org/wiki/Algorithmic_trading) strategy.


## Table of Contents

- [Backtest](#backtest)
  - [Table of Contents](#table-of-contents)
  - [Installation](#installation)
  - [Usage](#usage)
  - [Support](#support)
  - [Contributing](#contributing)
  - [Testing](#testing)


## Installation

    $ pip install backtest


## Preparation 

Fetching symbols of KOSPI and KOSDAQ exchanges:


    $ python -m backtest.utils.symbols_krx symbols.json
    Fetched 2,820 symbols
    Saved in symbols.json


## Usage

The following will execute the backtest after loading configuration file, `config.json` in same directory.

    python -m backtest

Sample content of `config.json`
```json
{
  "cash": 1000000,
  "ticks_dir": "ticks",
  "ledger_dir": "ledger",
  "symbols_file": "symbols.json",
  "strategy": "strategy",
  "exchanges": [
    "backtest.exchanges.kospi",
    "backtest.exchanges.kosdaq"
  ]
}
```


## Support

Please [open an issue](https://github.com/yoonbae82/backtest/issues/new) for support.


## Contributing

Please contribute using [Github Flow](https://guides.github.com/introduction/flow/). Create a branch, add commits, and [open a pull request](https://github.com/yoonbae/backtest/compare/).


## Testing

Test codes are prepared in _tests/_ based on [PyTest](https://docs.pytest.org/en/latest/) framework.
wkstools 0.1.2
IBM Watson Natural Language Understanding + Watson Knowledge Studio tools 
Requires Python: >=3.6

wkstools
=============
wkstools is a small convenience library that provides utilities to efficiently work with entities and relations provided by IBM Natural Language Understanding.

![PyPI - License](https://img.shields.io/pypi/l/wkstools)
![PyPI](https://img.shields.io/pypi/v/wkstools)

## Intuition

When using IBM Watson Knowledge Studio (WKS) models in IBM Natural Language Understanding (NLU), in most cases the resulting JSON requires post-processing to work with the extracted entities and relations.
This is where wkstools comes to help:

Let's assume you have trained a machine learning model in IBM Watson Knowledge Studio that recognizes relations between quantifiers, numbers and units. 
`"I want a smartphone that weighs no more than 160 g."`

If we want to build a tool that allows natural language searches for smartphone against a product database, you need to understand the relevant concepts in a structured manner. 
For the above example it will be helpful to extract the relations that point from the operator (`no more than`) to the (`value`) and the unit (`g`).

See the `intuition.py` and `nlu_response.json` in the exmaples folder to have a running example.


## Requirements

- Python 3.6+
- Pydantic

## Installation
```console
$ pip install wkstools
```

## Usage

### Parse entities and relations
To parse the NLU JSON response retrieved from IBM Natural Language Understanding, use:
```python
import wkstools

# Your NLU JSON response to process
nlu_response = '{..., "relations": [{"type": "specifiesValue", ...], "entities": [...]}' 

entities = wkstools.parse_entities(nlu_response)
relations = wkstools.parse_relations(nlu_response)
```
See the entity and relation models for available fields.

### Access specific relations
```python
import wkstools

# Your NLU JSON response to process
nlu_response = '{..., "relations": [{"type": "specifiesValue", ...], "entities": [...]}' 

relations = wkstools.parse_relations(nlu_response)

value_relations = wkstools.get_relations_by_type(relations, "specifiesValue")
```

## Testing
To lint and test, run:
```console
$ ./scripts/test.sh
```

To get the html coverage report run:
```console
$ ./scripts/test-cov-report.sh
```

## License
This project is licensed under the terms of the MIT license.