Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
206 commits
Select commit Hold shift + click to select a range
2774611
Blind stab at a basic chart
goodboy Apr 25, 2019
503aa8a
Use darkstyle pkg
goodboy May 2, 2019
bb81d78
Use qt5 and trio guest mode
goodboy Jun 10, 2020
9c84e3c
Add initial Qt-trio integration
goodboy Jun 10, 2020
eddd8aa
Add charting components from `Quantdom`
goodboy Jun 10, 2020
b670af4
Move UI spawning cmds to new module
goodboy Jun 10, 2020
2ad3b6f
Add piker chart command
goodboy Jun 10, 2020
c8afdb0
Styling, start re-org, commenting
goodboy Jun 13, 2020
730241b
Add scrolling from right and cross-hair
goodboy Jun 13, 2020
a7fe18c
Factor common chart configuration
goodboy Jun 14, 2020
fbce033
Lol I guess we probably need this
goodboy Jun 14, 2020
d8ca799
Start grouping interactions into a ``ViewBox``
goodboy Jun 14, 2020
ac389c3
Move drawing and resize behavior into chart widget
goodboy Jun 15, 2020
6fa173a
Factor components into more suitably named modules
goodboy Jun 15, 2020
507368a
Don't scroll right after max zoom
goodboy Jun 15, 2020
613564b
Add ui package mod
goodboy Jun 16, 2020
f77a39c
Add symbol-info command
goodboy Jun 16, 2020
45906c2
Render plots from provided input sequence(s)
goodboy Jun 16, 2020
b82587f
Use a single array for all lines
goodboy Jun 16, 2020
51f3021
Add update method for last bars graphic
goodboy Jun 17, 2020
36ac26c
Add zeroed ohlc array constructor
goodboy Jun 17, 2020
9d6dffe
Cleanup yrange auto-update callback
goodboy Jun 17, 2020
82a5daf
Move all kivy ui components to subpackage
goodboy Jun 17, 2020
0b5af4b
Move all Qt components into top level ui module
goodboy Jun 17, 2020
14bff66
Add a sane pandas.DataFrame to recarray converter
goodboy Jun 17, 2020
cc4b51c
Rip out all usage of `quantdom.bases.Quotes` smh.
goodboy Jun 18, 2020
d993147
Factor signalling api into new module
goodboy Jun 18, 2020
6ba0692
Revert weird bad .time access
goodboy Jun 18, 2020
048a13d
Drop disk caching of quotes
goodboy Jun 18, 2020
5e8e48c
Support updating bars graphics from array
goodboy Jun 19, 2020
2f1fdaf
Rework charting internals for real-time plotting
goodboy Jun 19, 2020
99c18ab
Add symbol search to broker api
goodboy Jun 24, 2020
7a660b3
Make search work with ib backend
goodboy Jul 2, 2020
16e2e27
Handle high = low bars
goodboy Jul 3, 2020
ecfa6d3
Use msgpack-numpy
goodboy Jul 3, 2020
4c753b5
Add ib
goodboy Jul 3, 2020
013c0fe
Fix a bunch of scrolling / panning logic
goodboy Jul 4, 2020
6b1bdbe
Docs the ui pkg mod
goodboy Jul 7, 2020
9c1d644
Handle flat bar updates
goodboy Jul 7, 2020
3c55f7c
Use structure array indexing syntax
goodboy Jul 8, 2020
2dec32e
Move bar generation into func; support bar appends
goodboy Jul 8, 2020
5f89a2b
Make run_qtrio invoke tractor at top level
goodboy Jul 8, 2020
4c5bc19
Always convert to posix time
goodboy Jul 8, 2020
b9224cd
Add WIP real-time 5s bar charting
goodboy Jul 8, 2020
2dd596e
Deps bump
goodboy Jul 8, 2020
4ceffdd
Drop kivy stuff from docs
goodboy Jul 8, 2020
f9084b8
Store lines graphics in struct array to simplify indexing
goodboy Jul 9, 2020
6802675
Add kraken to backend list
goodboy Jul 15, 2020
1a1e768
Port to new data apis
goodboy Jul 15, 2020
88fb7a8
Handle overloaded arg
goodboy Jul 15, 2020
e5bca1e
Fix import error
goodboy Jul 15, 2020
3aebeb5
Standardize ohlc dtype
goodboy Jul 15, 2020
788771b
Change name to qtractor
goodboy Jul 15, 2020
c56aee6
Use array of names for lookup
goodboy Jul 15, 2020
b4f1ec7
Massively simplify the cross-hair monstrosity
goodboy Jul 17, 2020
bbe0257
Allow for dynamically added plots
goodboy Jul 17, 2020
ad519c1
Always just look up the current plot on mouse handling
goodboy Jul 17, 2020
46c804d
Support the `stream_quotes()` api in questrade backend
goodboy Jul 20, 2020
cb8215c
Also log the payload
goodboy Jul 31, 2020
ec4f747
Drop "pipfiles"; pipenv is getting the hard boot
goodboy Aug 2, 2020
dc919fa
Set tractor loglevel in cli config
goodboy Aug 2, 2020
7a78c3a
Add a couple more deps
goodboy Aug 2, 2020
1a143f6
Pass piker log level through to tractor for chart app
goodboy Aug 2, 2020
2eea946
Drop forkserver usage.
goodboy Aug 2, 2020
d81f662
Passthrough loglevel from qtractor
goodboy Aug 2, 2020
b2506b0
Attempt more reliable chart startup
goodboy Aug 2, 2020
971b871
Handle "mouse-not-on-plot" edge cases
goodboy Aug 2, 2020
6b572eb
Add ravel() reference link
goodboy Aug 3, 2020
65fb92e
Flatten out chart tasks
goodboy Aug 3, 2020
81fb327
Add `services` cmd for monitoring actors
goodboy Aug 4, 2020
9bbf0e0
Add a normalizer routine which emits quote differentials/ticks
goodboy Aug 9, 2020
241b237
Port `DataFeed` api to broker specific normalizer routine
goodboy Aug 10, 2020
8a46f8d
Port monitor to normalized streams
goodboy Aug 10, 2020
a29b7d9
Start "interaction" module
goodboy Aug 15, 2020
04e21a9
Use partial, pass kwargs to `tractor._main()`
goodboy Aug 19, 2020
edb32e8
Drop weird chart type enum
goodboy Aug 19, 2020
fd21f4b
WIP initial draft of FSP subsystem
goodboy Aug 19, 2020
61e460a
Start brokers.api module
goodboy Aug 21, 2020
f46fa99
Add "contents" labels to charts
goodboy Aug 26, 2020
58b2e7e
Refer to main chart's data for date axis
goodboy Aug 27, 2020
8d29338
Cleanup latency tracker
goodboy Aug 27, 2020
d7466a5
Add updateable y-sticky label
goodboy Aug 30, 2020
363d4cf
Start color map
goodboy Aug 30, 2020
7a245dd
Add and update y-sticky labels on new price data
goodboy Aug 30, 2020
fca6257
Use dashed lines for crosshair
goodboy Aug 30, 2020
387a696
Even more colors
goodboy Aug 31, 2020
ea2a675
Use dashed crosshair, simplify x-axis alloc
goodboy Aug 31, 2020
17d205f
Add proper x-axis time-stamping
goodboy Aug 31, 2020
f1b72df
Better bg color, tweak margins.
goodboy Aug 31, 2020
0e51359
Info log fsp output for now
goodboy Sep 1, 2020
48c70e8
better readme
goodboy Sep 2, 2020
aed310d
Kill pipenv
goodboy Sep 2, 2020
b1591e3
Start mucking with faster bars updates
goodboy Sep 6, 2020
9d8a867
Bar graphics update speed improvements
goodboy Sep 7, 2020
7d24e8e
First draft of real-time rsi using numba
goodboy Sep 8, 2020
ee6e4d2
Add colorama for numba tracebacks
goodboy Sep 8, 2020
9a59f24
Start fsp subpackage, separate momo stuff
goodboy Sep 9, 2020
fc0a03d
Handle OHLC *and* signal indexing
goodboy Sep 9, 2020
80f191c
Adjust range logic to avoid overlap with labels
goodboy Sep 9, 2020
da23252
Copy non-base dtype fields on bar increment
goodboy Sep 10, 2020
a4a5bff
Yes, even more grays
goodboy Sep 10, 2020
e91ba55
Always draw any history bars on update
goodboy Sep 11, 2020
eb5d64c
Add support for overlay curves and fixed y-range
goodboy Sep 11, 2020
2cc2b32
Fix dbz with `np.divide()`
goodboy Sep 11, 2020
07beec5
Hopefully fix datum offset on signal sub-plots
goodboy Sep 11, 2020
2f1e9ee
Update dev deps to current state of things..
goodboy Sep 12, 2020
712e36b
First draft of a shared numpy array sub-system
goodboy Sep 16, 2020
17491ba
Disconnect stdlib's resource_tracker, fix .push()
goodboy Sep 17, 2020
f872fbe
Hook IB up to shared memory system
goodboy Sep 17, 2020
6fa4f6e
Port charts to new shm arrays
goodboy Sep 17, 2020
cd540fd
Cleanups
goodboy Sep 17, 2020
38469bd
Slight rework: shm API
goodboy Sep 22, 2020
b1093dc
Add a `data.Feed` type
goodboy Sep 22, 2020
d93ce84
Variety of IB backend improvements
goodboy Sep 22, 2020
373ff90
Only need UTC offset hacking if time w broker is messed..
goodboy Sep 22, 2020
efb52f2
Make shared array buffer incrementer a message pub
goodboy Sep 22, 2020
561cafb
Another black
goodboy Sep 22, 2020
ba4261f
Add timeit prints
goodboy Sep 22, 2020
4383579
Use shm array in chart-fsp task
goodboy Sep 23, 2020
2fcbefa
Use shm in fsp cascading
goodboy Sep 23, 2020
bfa7839
Adopt official color
goodboy Sep 23, 2020
268e748
Drop extra prefix in logs
goodboy Sep 23, 2020
3f0e175
Get bar oriented RSI working correctly
goodboy Sep 23, 2020
41e85cc
Break wma calc into sync func
goodboy Sep 24, 2020
e3e219a
Add multi-symbol-buffer increment support
goodboy Sep 25, 2020
8832804
Sub each new symbol to shm incrementing
goodboy Sep 25, 2020
155c3ee
Convert timeit thing to use print()
goodboy Sep 25, 2020
8e2e695
Revert project name removal; breaks shit elsewhere somehow..
goodboy Sep 25, 2020
47d4ec5
Move _source under data package
goodboy Sep 26, 2020
8a4528c
Always ask backend for ohlc dtype
goodboy Sep 26, 2020
d4eb5cc
Handle vwap overlay with shm
goodboy Sep 26, 2020
bc65040
Add shm support to kraken backend
goodboy Sep 26, 2020
acc8dd6
Add data._normalize.py ...
goodboy Sep 26, 2020
bceeaa5
Drop ringbuf, didn't end up using
goodboy Sep 29, 2020
e524ee9
Resize everything with HiDPI scaling on
goodboy Sep 29, 2020
8276b02
Further label and axis sizing tweaks for hidpi
goodboy Sep 29, 2020
6d5ccc6
Specify font size in pixels
goodboy Sep 29, 2020
8d9a684
Add a naive maxmin calc to avoid frequent resizes
goodboy Sep 29, 2020
2302e59
3k bars for now, ignore rtTime
goodboy Sep 29, 2020
18097fc
Scale for hidpi pixmaps too
goodboy Sep 29, 2020
db273e1
Up the mouse re-draw rate limit
goodboy Oct 12, 2020
e061367
Fix chart command derp
goodboy Oct 15, 2020
454b445
Add better shared mem writer task checking
goodboy Oct 15, 2020
cb72662
Add warnings for shm cache misses
goodboy Oct 15, 2020
6f429b1
These seem to be "faster" crosshair settings?
goodboy Oct 15, 2020
f4c3862
Add a default "bars from right" style setting
goodboy Oct 15, 2020
58d3234
Drop lingering print
goodboy Oct 16, 2020
fc23b21
Pass through fonts to axes
goodboy Oct 16, 2020
c7d5ea6
Fix static yrange and last bar double draw issues
goodboy Oct 16, 2020
d3dc8fb
Differentiate array schema by close field
goodboy Oct 19, 2020
32974a1
Add hidpi comments, 300 bars in view at startup
goodboy Oct 19, 2020
1706b67
Note the issues with the shared fsp array index..
goodboy Oct 19, 2020
851104d
Add an inf horizontal line helper
goodboy Oct 19, 2020
c57f678
Fix contents labels issues
goodboy Oct 19, 2020
1902507
Change scroll "center" to rightmost bar on screen
goodboy Oct 20, 2020
88583d9
Add "follow mode"
goodboy Oct 20, 2020
1f6b5da
Add support for curve "cursors" using a filled dot
goodboy Oct 21, 2020
875bc8b
Add line dots cursors to curves by default
goodboy Oct 21, 2020
cd828db
Show 24 bars to left on startup
goodboy Oct 21, 2020
f2c4a46
Center bars around index, adjust curves back to match...
goodboy Oct 21, 2020
18dc809
Add naive digits count routine
goodboy Oct 22, 2020
7be624d
Implement `tickStrings` for price axis; use float_digits()
goodboy Oct 23, 2020
8c25892
Fix (really sidestep) flat bar rendering issue(s)
goodboy Oct 23, 2020
8eb4344
More "thematic" default view values ;)
goodboy Oct 23, 2020
13f32ac
Only update history on bar increment
goodboy Oct 23, 2020
94a8ee6
Optimize axis labels using `QPicture`
goodboy Oct 25, 2020
ece57b2
Rename our main color
goodboy Oct 25, 2020
f32763d
Only move x-axis sticky when we mouse-over a new index
goodboy Oct 25, 2020
bed6a63
Don't pass color down to axis
goodboy Oct 25, 2020
7a268ea
Draft screen / font / dpi info script
goodboy Oct 25, 2020
55f34df
Start a profiling mod
goodboy Oct 26, 2020
89d48af
Size axis labels based on text contents
goodboy Oct 27, 2020
23672fc
Rework axes types, sizing stuff
goodboy Oct 27, 2020
751cca3
Attempt to calculate font size by DPI
goodboy Oct 27, 2020
20a4aed
Update font metrics after dpi calc; facepalm.
goodboy Oct 28, 2020
031eab2
Adjust contents label font for DPI
goodboy Oct 28, 2020
6fd3104
Add resource links to DPI snippet
goodboy Oct 28, 2020
68304b7
More thematic max datums on screen
goodboy Oct 28, 2020
aade0e5
Pin to our pyqtgraph branch; fixes transform invert performance
goodboy Oct 28, 2020
416f027
Flip contents label stuff into a type
goodboy Oct 29, 2020
da0789e
Add symbol field to kraken quotes
goodboy Oct 29, 2020
307c501
Add symbol field to ib quotes
goodboy Oct 29, 2020
9e7aa3f
Add a dpi aware font wrapper type
goodboy Nov 2, 2020
96f700a
Add level line type with custom label
goodboy Nov 2, 2020
119196f
Scale level label correctly to small(er) fonts
goodboy Nov 2, 2020
b23e459
Cleanup unneeded commented stuff
goodboy Nov 2, 2020
1640906
Write shm volume (facepalm), update open=close on first volume
goodboy Nov 3, 2020
22f1b56
Always update left (open) arm
goodboy Nov 3, 2020
d92e02d
Add back min window size i guess
goodboy Nov 3, 2020
e65f511
Draw flat line on every new time step
goodboy Nov 3, 2020
a5d5208
Add sticky "orientation", allow overriding label draw instructions.
goodboy Nov 3, 2020
987c13c
Classify L1 tick types
goodboy Nov 3, 2020
73e54a2
Add L1 labels wrapper type
goodboy Nov 4, 2020
f438139
Update L1 labels in price loop
goodboy Nov 4, 2020
9c38508
Add all L1 tick types for ib
goodboy Nov 5, 2020
db075b8
Specialize `LevelLabel` for orientation-around-axis gymnastics
goodboy Nov 5, 2020
cc88300
Fix L1 updates to be like TWS
goodboy Nov 5, 2020
1e491fb
Use pyqtgraph default pen for level lines
goodboy Nov 5, 2020
205bedc
Spec dpi aware font size in inches
goodboy Nov 6, 2020
e27fece
Add L1 queue size precision controls
goodboy Nov 6, 2020
043bc98
Configure L1 queue size precisions from history
goodboy Nov 6, 2020
be4a3df
Add L1 spread streaming to kraken
goodboy Nov 6, 2020
c1109ee
Add license headers to pertinent files
goodboy Nov 6, 2020
bdcee2b
Readme bump
goodboy Nov 6, 2020
0f458f8
Add min tick setting to axis type
goodboy Nov 6, 2020
1972740
Make salotz stop grumbling like an old man
goodboy Nov 6, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions Pipfile

This file was deleted.

644 changes: 0 additions & 644 deletions Pipfile.lock

This file was deleted.

160 changes: 71 additions & 89 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,130 +1,112 @@
piker
-----
Trading gear for hackers.
trading gear for hackers.

|travis|
|gh_actions|

``piker`` is an attempt at a pro-grade, broker agnostic, next-gen FOSS toolset for real-time
trading and financial analysis targetted at hardcore Linux users.
.. |gh_actions| image:: https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fpikers%2Fpiker%2Fbadge&style=popout-square
:target: https://actions-badge.atrox.dev/piker/pikers/goto

It tries to use as much bleeding edge tech as possible including (but not limited to):
``piker`` is a broker agnostic, next-gen FOSS toolset for real-time
trading targeted at hardcore Linux users.

- Python 3.7+ for glue_ and business logic
- trio_ for async
- tractor_ as the underlying actor model
we use as much bleeding edge tech as possible including (but not limited to):

- latest python for glue_
- trio_ for `structured concurrency`_
- tractor_ for distributed, multi-core, real-time streaming
- marketstore_ for historical and real-time tick data persistence and sharing
- techtonicdb_ for L2 book storage
- Qt_ for pristine high performance UIs
- pyqtgraph_ for real-time charting
- ``numpy`` and ``numba`` for `fast numerics`_

.. |travis| image:: https://img.shields.io/travis/pikers/piker/master.svg
:target: https://travis-ci.org/pikers/piker
.. _trio: https://github.com/python-trio/trio
.. _tractor: https://github.com/goodboy/tractor
.. _structured concurrency: https://trio.discourse.group/
.. _marketstore: https://github.com/alpacahq/marketstore
.. _techtonicdb: https://github.com/0b01/tectonicdb
.. _Qt: https://www.qt.io/
.. _pyqtgraph: https://github.com/pyqtgraph/pyqtgraph
.. _glue: https://numpy.org/doc/stable/user/c-info.python-as-glue.html#using-python-as-glue
.. _fast numerics: https://zerowithdot.com/python-numpy-and-pandas-performance/


Focus and Features:
focus and features:
*******************
- 100% federated: running your code on your hardware with your
broker's data feeds, privately, **is the point** (this is not a web-based *I
don't know how to run my own system* project).
- Asset class, broker, exchange agnostic.
- Built on a highly reliable `structured concurrent actor model
<tractor>`_ with built in async streaming and scalability protocols
allowing for a distributed architecture from the ground up.
- Privacy: your orders, indicators, algos are all run client side and
are shared only with the (groups of) traders you specify.
- Production grade, highly attractive native UIs that feel and fit like
a proper pair of skinny jeans; only meant to be used with a proper
tiling window manager (no, we are not ignorant enough to roll our own).
- Sophisticated charting capable of processing large data sets in real-time
while sanely displaying complex models and strategy systems.
- Built-in support for *hipstery* indicators and studies that you
probably haven't heard of but that the authors **know** generate alpha
when paired with the right strategies.
- Emphasis on collaboration through sharing of data, ideas, and processing
power. We will not host your code in the cloud nor ask you to
participate in any lame "alpha competitions".
- Adoption is very low priority, especially if you're not an experienced
trader; the system is not built for sale it is built for *people*.
- No, we will never have a "corporation friendly license"; if you intend to use
this code base we must know about it.

Fitting with these tenets, we're always open to new framework suggestions and ideas.

Building the best looking, most reliable, keyboard friendly trading platform is the dream.
Feel free to pipe in with your ideas and quiffs.


Install
- zero web, cloud or "backtesting frameworks" (aka yabf)
- zero self promotion (aka pump); expected throughout the community
- 100% federated: your code, your hardware, your data feeds, your broker fills
- broker/exchange/asset-class agnostic
- privacy
- real-time financial signal processing from the ground up
- high quality, attractive, native UX with expected use in tiling wms
- sophisticated rt charting and data sharing facilities
- geared for collaboration within trader communities
- zero interest in adoption by suits; no corporate friendly license, ever.
- not built for *sale*; built for *people*

fitting with these tenets, we're always open to new framework
suggestions and ideas.

building the best looking, most reliable, keyboard friendly trading
platform is the dream. feel free to pipe in with your ideas and quiffs.


install
*******
``piker`` is currently under heavy pre-alpha development and as such should
be cloned from this repo and hacked on directly.

A couple bleeding edge components are being used atm pertaining to
async ports of libraries for use with `trio`_.

Before installing make sure you have `pipenv`_ and have installed
``python3.7`` as well as `kivy source build`_ dependencies
since currently there's reliance on an async development branch.

`kivy` dependencies
===================
On Archlinux you need the following dependencies::

pacman -S python-docutils gstreamer sdl2_ttf sdl2_mixer sdl2_image xclip

To manually install the async branch of ``kivy`` from github do (though
this should be done as part of the ``pipenv install`` below)::

pipenv install -e 'git+git://github.com/matham/kivy.git@async-loop#egg=kivy'
``piker`` is currently under heavy pre-alpha development and as such
should be cloned from this repo and hacked on directly.

a couple bleeding edge components are being used atm pertaining to
new components within `trio`_.

.. _kivy source build:
https://kivy.org/docs/installation/installation-linux.html#installation-in-a-virtual-environment


For a development install::
for a development install::

git clone git@github.com:pikers/piker.git
cd piker
pipenv install --pre -e .
pipenv shell
pip install -e .


Broker Support
broker Support
**************
For live data feeds the only fully functional broker at the moment is Questrade_.
Eventual support is in the works for `IB`, `TD Ameritrade` and `IEX`.
If you want your broker supported and they have an API let us know.

.. _Questrade: https://www.questrade.com/api/documentation


Play with some UIs
******************

To start the real-time index monitor with the `questrade` backend::
for live data feeds the in-progress set of supported brokers is:

piker -l info monitor indexes
- IB_ via ``ib_insync``
- questrade_ which comes with effectively free L1
- kraken_ for crypto over their public websocket API

coming soon...

If you want to see super granular price changes, increase the
broker quote query ``rate`` with ``-r``::
- webull_ via the reverse engineered public API
- yahoo via yliveticker_
- coinbase_ through websocket feed

piker monitor indexes -r 10
if you want your broker supported and they have an API let us know.

.. _IB: https://interactivebrokers.github.io/tws-api/index.html
.. _questrade: https://www.questrade.com/api/documentation
.. _kraken: https://www.kraken.com/features/api#public-market-data
.. _webull: https://github.com/tedchou12/webull
.. _yliveticker: https://github.com/yahoofinancelive/yliveticker
.. _coinbase: https://docs.pro.coinbase.com/#websocket-feed

It is also possible to run the broker data feed micro service as a daemon::
check out our charts
********************
bet you weren't expecting this from the foss bby::

pikerd -l info
piker -b kraken chart XBTUSD

Then start the client app as normal::

piker monitor indexes
if anyone asks you what this project is about
*********************************************
you don't talk about it.

how do i get involved?
**********************
enter the matrix.

.. _pipenv: https://docs.pipenv.org/
learning the code is to your benefit and acts as a filter for desired
users; many alpha nuggets within.
5 changes: 5 additions & 0 deletions piker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@
"""
piker: trading gear for hackers.
"""
import msgpack # noqa
import msgpack_numpy

# patch msgpack for numpy arrays
msgpack_numpy.patch()
16 changes: 16 additions & 0 deletions piker/_async_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# piker: trading gear for hackers
# Copyright (C) 2018-present Tyler Goodlet (in stewardship of piker0)

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.

# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

"""
Async utils no one seems to have built into a core lib (yet).
"""
Expand Down
35 changes: 35 additions & 0 deletions piker/_profile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# piker: trading gear for hackers
# Copyright (C) 2018-present Tyler Goodlet (in stewardship of piker0)

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.

# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

"""
Profiling wrappers for internal libs.
"""
import time
from functools import wraps


def timeit(fn):
@wraps(fn)
def wrapper(*args, **kwargs):
t = time.time()
res = fn(*args, **kwargs)
print(
'%s.%s: %.4f sec'
% (fn.__module__, fn.__qualname__, time.time() - t)
)
return res

return wrapper
18 changes: 18 additions & 0 deletions piker/brokers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# piker: trading gear for hackers
# Copyright (C) 2018-present Tyler Goodlet (in stewardship of piker0)

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.

# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

"""
Broker clients, daemons and general back end machinery.
"""
Expand All @@ -11,6 +27,8 @@
__brokers__ = [
'questrade',
'robinhood',
'ib',
'kraken',
]


Expand Down
16 changes: 16 additions & 0 deletions piker/brokers/_util.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# piker: trading gear for hackers
# Copyright (C) 2018-present Tyler Goodlet (in stewardship of piker0)

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.

# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

"""
Handy utils.
"""
Expand Down
Loading