This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
RASPBIAN_URL=http://director.downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2018-06-29/2018-06-27-raspbian-stretch-lite.zip | |
PYTHON_URL=https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tar.xz | |
KPARTX=${KPARTX:-/sbin/kpartx} | |
QEMU_ARM=${QEMU_ARM:-/usr/bin/qemu-arm-static} | |
PROOT=${PROOT:-/usr/bin/proot} | |
SHA256SUM=${SHA256SUM:-/usr/bin/sha256sum} | |
WGET=${WGET:-/usr/bin/wget} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@pytest.mark.asyncio | |
@pytest.mark.indicators(ror_periods=(10, )) | |
async def test_strategy_momentum_manual_live(zmq_client, | |
feed_task, update_task, broker_task, | |
admin_user, stock_data, indicators): | |
stocks, sessions, quotes = stock_data | |
strategy = MomentumStrategy.objects.create(automatic=False, period=60, top_stocks=1, ror_period=10, pause=True) | |
portfolio = Portfolio.objects.create(user=admin_user, name='Test Portfolio', strategy=strategy) | |
transaction = Transaction.objects.create(portfolio=portfolio, session=sessions[0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@pytest.mark.asyncio | |
@pytest.mark.indicators(ror_periods=(10, )) | |
async def test_strategy_momentum_automatic(zmq_client, | |
update_task, broker_task, | |
admin_user, stock_data, indicators): | |
stocks, sessions, quotes = stock_data | |
strategy = MomentumStrategy.objects.create(automatic=True, period=60, top_stocks=1, ror_period=10) | |
portfolio = Portfolio.objects.create(user=admin_user, name='Test Portfolio', strategy=strategy) | |
transaction = Transaction.objects.create(portfolio=portfolio, session=sessions[0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@pytest.mark.asyncio | |
@pytest.mark.django_db | |
async def test_request(zmq_client, feed_task, test_month): | |
stocks, sessions, quotes = test_month | |
subscription = zmq_client.subscribe('quotes', 'quote') | |
reply, count = await zmq_client._async(feed_task.request, | |
start=datetime(2017, 1, 1), | |
end=datetime(2017, 1, 3)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@pytest.mark.asyncio | |
@pytest.mark.django_db | |
async def test_refresh_existing_cash(zmq_context, event_loop, | |
update_task, broker_task, | |
admin_user, test_month): | |
stocks, sessions, quotes = test_month | |
portfolio = Portfolio.objects.create(user=admin_user, name='Test Portfolio') | |
transaction = Transaction.objects.create(portfolio=portfolio, session=sessions[0]) | |
TransactionItemCash.objects.create(transaction=transaction, cash=10000, commission=30) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from contextlib import suppress | |
import itertools | |
import sys | |
if __name__ == '__main__': | |
lhs_file = open(sys.argv[1]) | |
rhs_file = open(sys.argv[2]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3.4 | |
import pyglet | |
from vector import Vector | |
class Entity: | |
def __init__(self, name, *args, **kwargs): | |
self.name = name | |
super().__init__(*args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from collections import OrderedDict | |
import enum | |
import struct | |
class Field: | |
def __init__(self, format, type=int): | |
self.format = format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ADD AT THE END OF ~/.bashrc | |
source ~/.bash/prompt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################### | |
# # # # # # # | |
# # # # # ## # #### # | |
# # ### # # #S # # ## # # | |
# # # #### # # # | |
# ######### # # #### # | |
# # # #### # ## # # | |
# # #### # # # #### # | |
# # # ##### # # #### # | |
# ### # #### |