semvec/pypi-packages huggingface dataset:
beige 0.1.2
Python exchange engine
License: MIT
Requires Python: >=3.6.0

# Python native Exchange engine

![Website](https://img.shields.io/website?up_message=up&url=https%3A%2F%2Fgithub.com%2Falienbrett%2Fbeige%2F)![PyPI](https://img.shields.io/pypi/v/beige)![PyPI - License](https://img.shields.io/pypi/l/beige)![GitHub issues](https://img.shields.io/github/issues/alienbrett/beige)

### Beige

Why Beige?

Because it's not particularly attractive,
there's probably a better color out there,
but it kinda works.
I was surprised that there is no package existing with the name ```beige``` yet!


### A simple, slow, exchange library

Beige is a pretty simple library that provides the full functionality of a matching engine, with features for tracking account balances and ongoing quote.

### Example

Import the right bits, and spin up the engine
```python
from beige import Engine, Order, Market, Limit, Side

# Create the engine
eng = Engine()
```

Account balances can be initialized at the start of the market session
```python
# Start a person off with some given account balance
eng.accounts.init('person-a', {'$':100.01, 'TSLA':1})

# Person is missing 1 dollar, and owns 10 'what?'
eng.accounts.init('person-b', {'$':-1, 'what?':10})
```

Then orders can be submitted in a fairly intuitive way:
```python
# Limit buy order for 'what?' security, 1
# Store the ID, and we can query its status later
oid = eng.submit(
  Order(
    instrument = 'what?',
    type_ = Limit(10),
    side = Side.Sell,
    quantity = 5,
    entity = 'person-b',
  )
)

# Submit a market order that
eng.submit(
  Order(
    'WHAT?',
    Market(),
    Side.Buy,
    1,
    'person-a',
  )
)
```
Once the ID for an order has been retrieved, we can see the full information on the order at any time:
```python
o = eng.status(oid)
# type(o) == dict
# o.keys() == ['sym','price','side','qty','acct','id','submitted','filled','averagepx','filledtime','status']
```


A full chronological transaction dataset is available
```python
df = eng.txs
# df.columns = ['qty','px','time','sym']
```

At any point, a quote can be requested.
Note that `None` will be returned for any value that isn't available, for example, `last` will be empty if no transactions have taken place yet.
```python
bid, ask, last, bidsize, asksize, lastsize = eng.quote('TSLA')
```



### Limitations

* Speed. The software hasn't been fully optimized and many of the data structures could really benefit from a bit of love and care.
* Integer-only quantities
* All account entities and securities are case insensitive, and will be displayed in all caps
* the "$" security encodes cash, and is the base unit for all security transactions. Sorry ex-USA users!


### Testing

* Correctness => ```python3 tests.py```
* Speed => ```python3 tests.py speed```
* Profiler => ```python3 tests.py profile```

I'm averaging about 0.15 ms per order execution.
This works in the sequential market I'm working on, but this may be orders of magnitude slower than needed in your use case.
Feel free to improve the speed, but please pull request back to me.
email-keyword-matcher 1.0.0
Use respond to an email to trigger specific callbacks.
License: MIT
Requires Python: >=3.6
Keywords: email

README
======

![Continuous Integration](https://github.com/audrow/email-keyword-matcher/workflows/Continuous%20Integration/badge.svg)
[![codecov](https://codecov.io/gh/audrow/email-keyword-matcher/branch/master/graph/badge.svg)](https://codecov.io/gh/audrow/email-keyword-matcher)

Send an email and perform an action when a user responds with one of a set of keywords.

This currently has been tested using Gmail as a 
[less secure app](https://support.google.com/accounts/answer/6010255?hl=en).

## Features

* Runs a callback function if the email reply is a keyword
* Email the replier saying no keyword was found if the reply email doesn't contain a keyword
* Check if an email has been replied to

## Usage
```bash
pip install email-keyword-matcher
```

```python
from email_keyword_matcher import EmailKeywordMatcher
import time

host = 'smtp.gmail.com'
port = 567
sender_email = 'foo@bar.com'
receiver_email = 'bar@baz.com'
password = 'super-secret-password'

# Create an `EmailKeywordMatcher` object
#
# Note if you don't pass in credentials, you will be prompted
# for them
ekm = EmailKeywordMatcher(sender_email, password, host, port)

# Create keywords that will be looked for in the reply
# and associate a callback with them
ekm.add_keyword('done', lambda: print("'done' called"))
ekm.add_keyword('snooze', lambda: print("'snooze' called"))
ekm.add_keyword('cancel', lambda: print("'cancel' called"))

# Send and email
email_subject = "Checkin"
email_content = "Make sure to checkin"
ekm.send(receiver_email, email_subject, email_content)

# Check if that email has been replied to
while not ekm.is_response(receiver_email, email_subject):
    print("No email back yet")
    time.sleep(5)

# Perform the callback for the found keyword, or
# send another email to `receiver_email` saying that
# a valid keyword was not found.
ekm.process_received(receiver_email, email_subject)
```

## Meta

Audrow Nash - [@audrow](https://github.com/audrow) - [audrow@hey.com](mailto:audrow@hey.com)

Distributed under the MIT license. See `LICENSE.txt` for more information.

[https://github.com/audrow/email-keyword-matcher](https://github.com/audrow/email-keyword-matcher)