├── .gitignore ├── LICENSE ├── Procfile ├── README.md ├── apps ├── TA │ ├── __init__.py │ ├── indicators │ │ ├── __init__.py │ │ └── example_indicator.py │ ├── management │ │ ├── __init__.py │ │ └── commands │ │ │ ├── TA_cache_clean.py │ │ │ ├── TA_clock.py │ │ │ ├── TA_fill_gaps.py │ │ │ ├── TA_restore.py │ │ │ ├── TA_worker.py │ │ │ └── __init__.py │ ├── resources │ │ ├── __init__.py │ │ ├── abstract_resource.py │ │ ├── historical_data.py │ │ └── price_volume.py │ ├── storages │ │ ├── __init__.py │ │ ├── abstract │ │ │ ├── __init__.py │ │ │ ├── indicator.py │ │ │ ├── indicator_subscriber.py │ │ │ ├── key_value.py │ │ │ ├── ticker.py │ │ │ ├── ticker_subscriber.py │ │ │ ├── timeseries_storage.py │ │ │ └── volumeseries_storage.py │ │ ├── data │ │ │ ├── __init__.py │ │ │ ├── blockchain.py │ │ │ ├── price.py │ │ │ ├── pv_history.py │ │ │ └── volume.py │ │ └── utils │ │ │ ├── __init__.py │ │ │ ├── list_search.py │ │ │ ├── memory_cleaner.py │ │ │ ├── missing_data.py │ │ │ ├── pv_resampling.py │ │ │ └── sigfigs.py │ ├── tests │ │ ├── test_Indicators.py │ │ ├── test_Price.py │ │ └── test_PriceHistory.py │ └── urls.py ├── __init__.py ├── ai │ ├── __init__.py │ ├── management │ │ ├── __init__.py │ │ └── commands │ │ │ ├── __init__.py │ │ │ └── add_nn_model.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_auto_20180330_0936.py │ │ ├── 0003_add_more_sources.py │ │ └── __init__.py │ ├── models │ │ ├── __init__.py │ │ └── nn_model.py │ └── settings │ │ └── ai_preload.py ├── api │ ├── README.md │ ├── __init__.py │ ├── helpers.py │ ├── management │ │ └── commands │ │ │ ├── __init__.py │ │ │ └── generate_api_token.py │ ├── paginations.py │ ├── serializers.py │ ├── tests │ │ ├── __init__.py │ │ ├── test_api_v1.py │ │ ├── test_api_v2.py │ │ ├── test_api_v3.py │ │ └── test_helpers.py │ ├── urls.py │ └── views │ │ ├── __init__.py │ │ ├── ann_price_classification.py │ │ ├── events_elementary.py │ │ ├── events_logical.py │ │ ├── history_price.py │ │ ├── itt.py │ │ ├── price.py │ │ ├── resampled_price.py │ │ ├── rsi.py │ │ ├── sentiment.py │ │ ├── signal.py │ │ ├── sma.py │ │ ├── tickers.py │ │ ├── v1_csv.py │ │ ├── v1_price.py │ │ ├── v1_user.py │ │ ├── v1_volume.py │ │ └── volume.py ├── backtesting │ ├── __init__.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_auto_20180416_1542.py │ │ ├── 0003_auto_20180518_1551.py │ │ └── __init__.py │ └── models │ │ ├── __init__.py │ │ └── back_test.py ├── channel │ ├── __init__.py │ ├── incoming_queue.py │ ├── management │ │ ├── __init__.py │ │ └── commands │ │ │ ├── README.md │ │ │ ├── __init__.py │ │ │ ├── import_from_channel_exchangedata_csv.py │ │ │ ├── import_from_tob_history_csv.py │ │ │ ├── poll_queue.py │ │ │ ├── trawl_poloniex.py │ │ │ └── try_talib.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_add_more_sources.py │ │ └── __init__.py │ └── models │ │ ├── __init__.py │ │ └── exchange_data.py ├── common │ ├── __init__.py │ ├── admin.py │ ├── behaviors │ │ ├── __init__.py │ │ ├── annotatable.py │ │ ├── authorable.py │ │ ├── expirable.py │ │ ├── locatable.py │ │ ├── publishable.py │ │ ├── timestampable.py │ │ └── uploadable.py │ ├── forms │ │ └── __init__.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_auto_20181018_2026.py │ │ └── __init__.py │ ├── models │ │ ├── __init__.py │ │ ├── address.py │ │ ├── country.py │ │ ├── currency.py │ │ ├── document.py │ │ ├── image.py │ │ └── note.py │ ├── templates │ │ └── __init__.py │ ├── tests │ │ ├── __init__.py │ │ ├── test_behaviors │ │ │ ├── __init__.py │ │ │ ├── test_authorable.py │ │ │ ├── test_locatable.py │ │ │ ├── test_mixins.py │ │ │ ├── test_publishable.py │ │ │ ├── test_timestampable.py │ │ │ └── test_uploadable.py │ │ └── test_models │ │ │ ├── __init__.py │ │ │ ├── test_address.py │ │ │ ├── test_currency.py │ │ │ └── test_image.py │ ├── utilities │ │ ├── __init__.py │ │ ├── db.py │ │ ├── email.py │ │ ├── english_language.py │ │ ├── logger.py │ │ ├── model_fields.py │ │ ├── multithreading.py │ │ ├── regex.py │ │ ├── s3.py │ │ ├── sqs.py │ │ ├── transloadit.py │ │ ├── unicode_tools.py │ │ └── whois.py │ └── views │ │ └── __init__.py ├── dashboard │ ├── __init__.py │ ├── static │ │ └── __init__.py │ ├── templates │ │ ├── __init__.py │ │ ├── inclusions │ │ │ └── signal.html │ │ ├── main.html │ │ ├── market.html │ │ └── ticker.html │ ├── urls.py │ └── views │ │ ├── __init__.py │ │ ├── main.py │ │ ├── market.py │ │ └── ticker.py ├── indicator │ ├── README.md │ ├── __init__.py │ ├── management │ │ ├── __init__.py │ │ ├── commands │ │ │ ├── README.md │ │ │ ├── __init__.py │ │ │ ├── fill_price_history_missing_volumes.py │ │ │ ├── fill_price_resampl_volume_history.py │ │ │ └── hello_subscribers.py │ │ └── helpers.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_priceresampled.py │ │ ├── 0003_auto_20171030_2155.py │ │ ├── 0004_auto_20171104_1440.py │ │ ├── 0005_auto_20171206_1053.py │ │ ├── 0006_auto_20171207_1348.py │ │ ├── 0007_auto_20171207_1416.py │ │ ├── 0008_auto_20171208_1127.py │ │ ├── 0009_auto_20171208_1301.py │ │ ├── 0010_auto_20171212_0252.py │ │ ├── 0011_auto_20180129_1540.py │ │ ├── 0012_annpriceclassification.py │ │ ├── 0013_auto_20180330_0936.py │ │ ├── 0014_auto_20180330_1108.py │ │ ├── 0015_delete_priceresampled.py │ │ ├── 0016_add_more_sources.py │ │ ├── 0017_add_indexes_to_price_sma_priceresampl.py │ │ ├── 0018_auto_20180608_1150.py │ │ ├── 0019_auto_20180614_1013.py │ │ ├── 0020_auto_20180615_1317.py │ │ ├── 0021_pricehistory.py │ │ ├── 0022_pricehistory_volume.py │ │ ├── 0023_add_volume_to_price_resampl.py │ │ ├── 0024_add_index_to_pricehistory.py │ │ ├── 0025_add_unique_together_to_pricehistory.py │ │ ├── 0026_annpriceclassification_ai_model.py │ │ ├── 0027_priceresampl_volume_variance.py │ │ └── __init__.py │ ├── models │ │ ├── __init__.py │ │ ├── abstract_indicator.py │ │ ├── ann_future_price_classification.py │ │ ├── events_elementary.py │ │ ├── events_logical.py │ │ ├── events_probabilistic.py │ │ ├── price.py │ │ ├── price_history.py │ │ ├── price_resampl.py │ │ ├── rsi.py │ │ ├── sma.py │ │ └── volume.py │ └── scripts │ │ └── 2018-10-06-data-migration-populate_new_field_model_type.ipynb ├── info_bot │ ├── README.md │ ├── __init__.py │ ├── helpers.py │ ├── management │ │ ├── __init__.py │ │ └── commands │ │ │ ├── __init__.py │ │ │ └── run_info_bot.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_infobothistory_chat_title.py │ │ └── __init__.py │ ├── models │ │ ├── __init__.py │ │ └── info_bot_history.py │ ├── telegram │ │ ├── __init__.py │ │ ├── bot_commands │ │ │ ├── __init__.py │ │ │ ├── info.py │ │ │ ├── itf.py │ │ │ ├── price.py │ │ │ └── special_commands.py │ │ └── start_info_bot.py │ └── tests │ │ ├── __init__.py │ │ └── test_telegram_bot_helpers.py ├── sentiment │ ├── __init__.py │ ├── migrations │ │ ├── 0001_initial.py │ │ └── __init__.py │ ├── models │ │ ├── __init__.py │ │ ├── nn_sentiment.py │ │ ├── sentiment.py │ │ └── sentiment_analysis.py │ ├── static │ │ ├── css │ │ │ └── bootstrap.css │ │ ├── itf-logo-gray.png │ │ └── itf-logo-white.png │ ├── templates │ │ └── sentiment_index.html │ ├── urls.py │ └── views │ │ └── sentiment_dashboard.py ├── signal │ ├── README.md │ ├── README_CONNECT_TO_SNS.md │ ├── __init__.py │ ├── aws_lambda │ │ └── itf-core-prod-signals-adapter-for-zignaly │ │ │ └── lambda_function.py │ ├── management │ │ └── __init__.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_signal_timestamp.py │ │ ├── 0003_auto_20171113_2003.py │ │ ├── 0004_auto_20171115_0627.py │ │ ├── 0005_signal_rsi_value.py │ │ ├── 0006_auto_20171206_1053.py │ │ ├── 0007_auto_20171212_0252.py │ │ ├── 0008_signal_resample_period.py │ │ ├── 0009_auto_20180406_1217.py │ │ ├── 0010_add_more_sources.py │ │ ├── 0011_auto_20180604_1126.py │ │ └── __init__.py │ ├── models │ │ ├── __init__.py │ │ └── signal.py │ └── scripts │ │ ├── 2018-05-07-data-migration-trend-change.ipynb │ │ └── 2018-06-04-data-migration-trend-ANN-reverse.ipynb ├── strategy │ ├── README.md │ ├── __init__.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_auto_20180416_1542.py │ │ ├── 0003_strategyref_implementation_module_name.py │ │ ├── 0004_delete_strategyref.py │ │ └── __init__.py │ └── models │ │ ├── __init__.py │ │ ├── abstract_strategy.py │ │ ├── ai_strategies.py │ │ ├── baseline_strategies.py │ │ ├── ichi_strategies.py │ │ ├── multi_currency_strategies.py │ │ ├── rsi_sma_strategies.py │ │ ├── strategy_ref.py │ │ └── volume_based_strategies.py └── user │ ├── __init__.py │ ├── admin.py │ ├── fixtures │ └── __init__.py │ ├── forms │ └── __init__.py │ ├── migrations │ ├── 0001_initial.py │ ├── 0002_auto_20171018_1131.py │ ├── 0003_auto_20171019_1503.py │ ├── 0004_auto_20171115_0824.py │ ├── 0005_auto_20171115_0828.py │ ├── 0006_auto_20171116_0609.py │ ├── 0007_user_is_itt_team.py │ ├── 0008_auto_20181018_2026.py │ └── __init__.py │ ├── models │ ├── __init__.py │ └── user.py │ ├── templates │ └── __init__.py │ ├── urls.py │ └── views │ └── __init__.py ├── docs └── TEMP.md ├── manage.py ├── nltk.txt ├── requirements-frozen.txt ├── requirements.txt ├── runtime.txt ├── settings ├── __init__.py ├── local_settings_template.py ├── rabbitmq.py ├── redis_db.py ├── tickers.py ├── urls.py ├── vendor_services_settings.py └── wsgi.py ├── static ├── css │ └── base.css ├── javascript │ └── base.js └── vendor │ ├── bootstrap-theme │ ├── LICENSE │ ├── README.md │ ├── compiled │ │ ├── toolkit-inverse.css │ │ ├── toolkit-inverse.css.map │ │ ├── toolkit-inverse.min.css │ │ ├── toolkit-inverse.min.css.map │ │ ├── toolkit-light.css │ │ ├── toolkit-light.css.map │ │ ├── toolkit-light.min.css │ │ ├── toolkit-light.min.css.map │ │ ├── toolkit.js │ │ └── toolkit.min.js │ ├── docs │ │ ├── assets │ │ │ ├── css │ │ │ │ ├── application.css │ │ │ │ ├── docs.css │ │ │ │ ├── toolkit-inverse.css │ │ │ │ └── toolkit-light.css │ │ │ ├── fonts │ │ │ │ ├── toolkit-entypo.eot │ │ │ │ ├── toolkit-entypo.ttf │ │ │ │ ├── toolkit-entypo.woff │ │ │ │ └── toolkit-entypo.woff2 │ │ │ ├── img │ │ │ │ └── avatar-mdo.png │ │ │ └── js │ │ │ │ ├── application.js │ │ │ │ ├── chart.js │ │ │ │ ├── jquery.min.js │ │ │ │ ├── tablesorter.min.js │ │ │ │ ├── tether.min.js │ │ │ │ └── toolkit.js │ │ ├── bootstrap │ │ │ └── index.html │ │ ├── components │ │ │ ├── bootstrap.md │ │ │ ├── component-avatar-list.md │ │ │ ├── component-blocks.md │ │ │ ├── component-buttons-outline.md │ │ │ ├── component-buttons-pill.md │ │ │ ├── component-callouts.md │ │ │ ├── component-carousel-light.md │ │ │ ├── component-checklist.md │ │ │ ├── component-container-custom.md │ │ │ ├── component-dashhead.md │ │ │ ├── component-divided-heading.md │ │ │ ├── component-entypo.md │ │ │ ├── component-featured-lists.md │ │ │ ├── component-flextable.md │ │ │ ├── component-forms-custom.md │ │ │ ├── component-grid-table.md │ │ │ ├── component-growl.md │ │ │ ├── component-icon-input.md │ │ │ ├── component-iconav.md │ │ │ ├── component-iconlist.md │ │ │ ├── component-list-groups.md │ │ │ ├── component-media-list-conversation.md │ │ │ ├── component-media-list-stream.md │ │ │ ├── component-media-list-users.md │ │ │ ├── component-media.md │ │ │ ├── component-modals-custom.md │ │ │ ├── component-nav-bordered.md │ │ │ ├── component-navbars-transparent.md │ │ │ ├── component-navs.md │ │ │ ├── component-panel-bold.md │ │ │ ├── component-panel-link-list.md │ │ │ ├── component-panel-profile.md │ │ │ ├── component-profile-header.md │ │ │ ├── component-pull-quote.md │ │ │ ├── component-spacer-utilities.md │ │ │ ├── component-stat-cards.md │ │ │ ├── component-text-ribbons.md │ │ │ ├── component-thumbnails.html │ │ │ ├── intro.md │ │ │ ├── plugin-chartjs.md │ │ │ ├── plugin-datepicker.md │ │ │ ├── plugin-enter.md │ │ │ ├── plugin-image-grid.md │ │ │ ├── plugin-stage.md │ │ │ ├── plugin-tablesorter.md │ │ │ └── plugin-zoom.md │ │ ├── docs │ │ │ └── index.html │ │ ├── fluid-light │ │ │ └── index.html │ │ ├── fluid │ │ │ └── index.html │ │ ├── icon-nav-light │ │ │ └── index.html │ │ ├── icon-nav │ │ │ └── index.html │ │ ├── index-light │ │ │ └── index.html │ │ ├── index.html │ │ ├── order-history-light │ │ │ └── index.html │ │ └── order-history │ │ │ └── index.html │ ├── fonts │ │ ├── toolkit-entypo.eot │ │ ├── toolkit-entypo.ttf │ │ ├── toolkit-entypo.woff │ │ └── toolkit-entypo.woff2 │ ├── gulpfile.js │ ├── js │ │ ├── bootstrap │ │ │ ├── alert.js │ │ │ ├── button.js │ │ │ ├── carousel.js │ │ │ ├── collapse.js │ │ │ ├── dropdown.js │ │ │ ├── modal.js │ │ │ ├── popover.js │ │ │ ├── scrollspy.js │ │ │ ├── tab.js │ │ │ ├── tooltip.js │ │ │ └── util.js │ │ └── custom │ │ │ ├── affix.js │ │ │ └── datepicker.js │ ├── package.json │ └── scss │ │ ├── bootstrap │ │ ├── _alert.scss │ │ ├── _badge.scss │ │ ├── _breadcrumb.scss │ │ ├── _button-group.scss │ │ ├── _buttons.scss │ │ ├── _card.scss │ │ ├── _carousel.scss │ │ ├── _close.scss │ │ ├── _code.scss │ │ ├── _custom-forms.scss │ │ ├── _dropdown.scss │ │ ├── _forms.scss │ │ ├── _grid.scss │ │ ├── _images.scss │ │ ├── _input-group.scss │ │ ├── _jumbotron.scss │ │ ├── _list-group.scss │ │ ├── _media.scss │ │ ├── _mixins.scss │ │ ├── _modal.scss │ │ ├── _nav.scss │ │ ├── _navbar.scss │ │ ├── _normalize.scss │ │ ├── _pagination.scss │ │ ├── _popover.scss │ │ ├── _print.scss │ │ ├── _progress.scss │ │ ├── _reboot.scss │ │ ├── _responsive-embed.scss │ │ ├── _tables.scss │ │ ├── _tooltip.scss │ │ ├── _transitions.scss │ │ ├── _type.scss │ │ ├── _utilities.scss │ │ ├── _variables.scss │ │ ├── mixins │ │ │ ├── _alert.scss │ │ │ ├── _background-variant.scss │ │ │ ├── _badge.scss │ │ │ ├── _border-radius.scss │ │ │ ├── _breakpoints.scss │ │ │ ├── _buttons.scss │ │ │ ├── _cards.scss │ │ │ ├── _clearfix.scss │ │ │ ├── _float.scss │ │ │ ├── _forms.scss │ │ │ ├── _gradients.scss │ │ │ ├── _grid-framework.scss │ │ │ ├── _grid.scss │ │ │ ├── _hover.scss │ │ │ ├── _image.scss │ │ │ ├── _list-group.scss │ │ │ ├── _lists.scss │ │ │ ├── _nav-divider.scss │ │ │ ├── _navbar-align.scss │ │ │ ├── _pagination.scss │ │ │ ├── _reset-text.scss │ │ │ ├── _resize.scss │ │ │ ├── _screen-reader.scss │ │ │ ├── _size.scss │ │ │ ├── _table-row.scss │ │ │ ├── _text-emphasis.scss │ │ │ ├── _text-hide.scss │ │ │ ├── _text-truncate.scss │ │ │ ├── _transforms.scss │ │ │ └── _visibility.scss │ │ └── utilities │ │ │ ├── _align.scss │ │ │ ├── _background.scss │ │ │ ├── _borders.scss │ │ │ ├── _clearfix.scss │ │ │ ├── _display.scss │ │ │ ├── _flex.scss │ │ │ ├── _float.scss │ │ │ ├── _position.scss │ │ │ ├── _screenreaders.scss │ │ │ ├── _sizing.scss │ │ │ ├── _spacing.scss │ │ │ ├── _text.scss │ │ │ └── _visibility.scss │ │ ├── components.scss │ │ ├── custom │ │ ├── alerts-custom.scss │ │ ├── buttons-custom.scss │ │ ├── buttons-radius.scss │ │ ├── container-custom.scss │ │ ├── dashhead.scss │ │ ├── datepicker.scss │ │ ├── divider.scss │ │ ├── docs.scss │ │ ├── flex-table.scss │ │ ├── graphs.scss │ │ ├── iconav.scss │ │ ├── icons.scss │ │ ├── input-icon.scss │ │ ├── list-group-custom.scss │ │ ├── modals-custom.scss │ │ ├── nav-bordered.scss │ │ ├── nav-heading.scss │ │ ├── nav-toggler.scss │ │ ├── navbar-utilities.scss │ │ ├── navs-custom.scss │ │ ├── sidebar.scss │ │ ├── statcard.scss │ │ ├── statlist.scss │ │ ├── syntax.scss │ │ ├── tables-custom.scss │ │ ├── tablesorter.scss │ │ ├── text-inherit.scss │ │ ├── type-custom.scss │ │ └── utilities-spacer.scss │ │ ├── docs.scss │ │ ├── toolkit-inverse.scss │ │ ├── toolkit-light.scss │ │ ├── variables-inverse.scss │ │ └── variables.scss │ ├── bootstrap │ ├── css │ │ ├── bootstrap-grid.css │ │ ├── bootstrap-grid.css.map │ │ ├── bootstrap-grid.min.css │ │ ├── bootstrap-grid.min.css.map │ │ ├── bootstrap-reboot.css │ │ ├── bootstrap-reboot.css.map │ │ ├── bootstrap-reboot.min.css │ │ ├── bootstrap-reboot.min.css.map │ │ ├── bootstrap.css │ │ ├── bootstrap.css.map │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ ├── js │ │ ├── bootstrap.js │ │ └── bootstrap.min.js │ ├── v3 │ │ ├── css │ │ │ ├── bootstrap-theme.css │ │ │ ├── bootstrap-theme.css.map │ │ │ ├── bootstrap-theme.min.css │ │ │ ├── bootstrap-theme.min.css.map │ │ │ ├── bootstrap.css │ │ │ ├── bootstrap.css.map │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ ├── fonts │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.svg │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ └── glyphicons-halflings-regular.woff2 │ │ ├── js │ │ │ ├── bootstrap.js │ │ │ ├── bootstrap.min.js │ │ │ └── npm.js │ │ └── version=3.3.6 │ └── version=4.0.0-alpha.6 │ ├── jquery-autosave │ └── js │ │ ├── jquery-autosave.js │ │ └── jquery-autosave.min.js │ ├── jquery │ └── js │ │ ├── jquery-1.12.3.min.js │ │ ├── jquery-2.2.3.min.js │ │ └── jquery-3.2.1.min.js │ └── tether │ ├── .gitignore │ ├── .hsdoc │ ├── css │ ├── tether-theme-arrows-dark.css │ ├── tether-theme-arrows-dark.min.css │ ├── tether-theme-arrows.css │ ├── tether-theme-arrows.min.css │ ├── tether-theme-basic.css │ ├── tether-theme-basic.min.css │ ├── tether.css │ └── tether.min.css │ ├── js │ ├── tether.js │ └── tether.min.js │ └── version=1.3.3 ├── taskapp ├── README.md ├── __init__.py ├── celery.py ├── helpers │ ├── __init__.py │ ├── backtesting.py │ ├── common.py │ ├── indicators.py │ └── sentiment_analysis.py ├── tasks.py └── tests │ ├── __init__.py │ └── test_helpers.py ├── templates ├── __init__.py ├── account │ └── email │ │ ├── email_confirmation_message.txt │ │ └── email_confirmation_signup_subject.txt ├── base.html ├── footer.html ├── messages.html ├── messages │ ├── message.mustache │ └── messages.html └── navigation.html └── vendorlibs └── pyqs ├── __init__.py ├── decorator.py ├── main.py ├── utils.py └── worker.py /Procfile: -------------------------------------------------------------------------------- 1 | release: python manage.py migrate 2 | web: waitress-serve --port=$PORT settings.wsgi:application 3 | worker: REMAP_SIGTERM=SIGQUIT celery --app=taskapp worker --concurrency=1 --hostname=$DYNO@%h -Ofair --purge --without-heartbeat --without-gossip --loglevel=debug 4 | scheduler: celery --app=taskapp beat --max-interval=10 -S redbeat.RedBeatScheduler 5 | pollqueue: python manage.py poll_queue 6 | infobot: python manage.py run_info_bot 7 | redis_TA_restore: python manage.py TA_restore 8 | redis_TA_worker: python manage.py TA_worker 9 | redis_TA_fill_gaps: python manage.py TA_fill_gaps -------------------------------------------------------------------------------- /apps/TA/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | import logging 3 | 4 | from settings import SHORT, MEDIUM, LONG 5 | # PERIODS_1HR, PERIODS_4HR, PERIODS_24HR = SHORT/5, MEDIUM/5, LONG/5 6 | 7 | JAN_1_2017_TIMESTAMP = int(1483228800) 8 | HORIZONS = [PERIODS_1HR, PERIODS_4HR, PERIODS_24HR] = [12, 48, 288] # num of 5 min samples 9 | PRICE_INDEXES = ['open_price', 'close_price', 'low_price', 'high_price', 'midpoint_price', 'mean_price', 'price_variance',] 10 | VOLUME_INDEXES = ['open_volume', 'close_volume', 'low_volume', 'high_volume',] 11 | 12 | deployment_type = os.environ.get('DEPLOYMENT_TYPE', 'LOCAL') 13 | if deployment_type == 'LOCAL': 14 | logging.basicConfig(level=logging.DEBUG) 15 | 16 | logger = logging.getLogger('core.apps.TA') 17 | 18 | 19 | class TAException(Exception): 20 | def __init__(self, message): 21 | self.message = message 22 | logger.error(message) 23 | 24 | class SuchWowException(Exception): 25 | def __init__(self, message): 26 | self.message = message 27 | such_wow = "==============SUCH=====WOW===============" 28 | logger.error(f'\n\n{such_wow}\n\n{message}\n\n{such_wow}') 29 | -------------------------------------------------------------------------------- /apps/TA/indicators/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/TA/indicators/__init__.py -------------------------------------------------------------------------------- /apps/TA/management/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/TA/management/__init__.py -------------------------------------------------------------------------------- /apps/TA/management/commands/TA_cache_clean.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | from django.core.management.base import BaseCommand 4 | 5 | from apps.TA.storages.utils.memory_cleaner import redisCleanup 6 | 7 | logger = logging.getLogger(__name__) 8 | 9 | 10 | class Command(BaseCommand): 11 | help = 'Run Cleanup for TA Storages on Redis' 12 | 13 | def handle(self, *args, **options): 14 | logger.info("Starting TA cache clean.") 15 | 16 | redisCleanup() 17 | 18 | from settings.redis_db import database 19 | if int(database.info()['used_memory']) > (2 ** 30 * .9): 20 | # todo: some major alert to upgrade the cache memory 21 | pass 22 | -------------------------------------------------------------------------------- /apps/TA/management/commands/TA_clock.py: -------------------------------------------------------------------------------- 1 | from apscheduler.schedulers.blocking import BlockingScheduler 2 | 3 | sched = BlockingScheduler() 4 | 5 | @sched.scheduled_job('interval', minutes=3) 6 | def timed_job(): 7 | print('This job is run every three minutes.') 8 | 9 | @sched.scheduled_job('cron', day_of_week='mon-fri', hour=17) 10 | def scheduled_job(): 11 | print('This job is run every weekday at 5pm.') 12 | 13 | sched.start() 14 | -------------------------------------------------------------------------------- /apps/TA/management/commands/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/TA/management/commands/__init__.py -------------------------------------------------------------------------------- /apps/TA/resources/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/TA/resources/__init__.py -------------------------------------------------------------------------------- /apps/TA/resources/abstract_resource.py: -------------------------------------------------------------------------------- 1 | """ 2 | redis-py includes a PubSub object that subscribes to channels and listens for new messages. 3 | https://github.com/andymccurdy/redis-py#publish--subscribe 4 | """ -------------------------------------------------------------------------------- /apps/TA/storages/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/TA/storages/__init__.py -------------------------------------------------------------------------------- /apps/TA/storages/abstract/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/TA/storages/abstract/__init__.py -------------------------------------------------------------------------------- /apps/TA/storages/abstract/volumeseries_storage.py: -------------------------------------------------------------------------------- 1 | import logging 2 | from apps.TA import TAException 3 | from apps.TA.storages.abstract.key_value import KeyValueStorage 4 | 5 | logger = logging.getLogger(__name__) 6 | 7 | 8 | class StorageException(TAException): 9 | pass 10 | 11 | class VolumeseriesException(TAException): 12 | pass 13 | 14 | 15 | class VolumeseriesStorage(KeyValueStorage): 16 | """ 17 | stores things in a sorted set unique to each ticker and exchange 18 | ordered by blocks of volume as opposed to time 19 | """ 20 | class_describer = "volumeseries" 21 | -------------------------------------------------------------------------------- /apps/TA/storages/data/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/TA/storages/data/__init__.py -------------------------------------------------------------------------------- /apps/TA/storages/data/blockchain.py: -------------------------------------------------------------------------------- 1 | import logging 2 | from apps.TA import TAException 3 | from apps.TA.storages.abstract.timeseries_storage import TimeseriesStorage 4 | 5 | 6 | logger = logging.getLogger(__name__) 7 | 8 | 9 | class BlockchainHistoryException(TAException): 10 | pass 11 | 12 | 13 | class BlockchainStatsHistory(TimeseriesStorage): 14 | def __init__(self, *args, **kwargs): 15 | super().__init__(*args, **kwargs) 16 | -------------------------------------------------------------------------------- /apps/TA/storages/utils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/TA/storages/utils/__init__.py -------------------------------------------------------------------------------- /apps/TA/storages/utils/list_search.py: -------------------------------------------------------------------------------- 1 | # https://stackoverflow.com/questions/16974047/efficient-way-to-find-missing-elements-in-an-integer-sequence/16974075#16974075 2 | from itertools import islice, chain 3 | 4 | def window(seq, n=2): 5 | "Returns a sliding window (of width n) over data from the iterable" 6 | " s -> (s0,s1,...s[n-1]), (s1,s2,...,sn), ... " 7 | it = iter(seq) 8 | result = tuple(islice(it, n)) 9 | if len(result) == n: 10 | yield result 11 | for elem in it: 12 | result = result[1:] + (elem,) 13 | yield result 14 | 15 | 16 | def missing_elements(L): 17 | L = list(set(L)) 18 | L.sort() 19 | missing = chain.from_iterable(range(x + 1, y) for x, y in window(L) if (y - x) > 1) 20 | return list(missing) 21 | -------------------------------------------------------------------------------- /apps/TA/storages/utils/sigfigs.py: -------------------------------------------------------------------------------- 1 | 2 | def round_sig_figs(value, sig_figs: int) -> float: 3 | value = float(value) 4 | non_decimal_place = len(str(int(value))) 5 | # decimal_places = max(len(str(value % 1))-2, 0) 6 | 7 | if value < 0: 8 | distance_from_decimal = 0 9 | for char in str(value): 10 | if char is ".": continue 11 | elif int(char) > 0: break 12 | else: distance_from_decimal += 1 13 | return round(value, (distance_from_decimal+sig_figs)) 14 | else: 15 | return round(value, (sig_figs-non_decimal_place)) 16 | -------------------------------------------------------------------------------- /apps/TA/urls.py: -------------------------------------------------------------------------------- 1 | from apps.TA.resources import historical_data, price_volume 2 | from django.conf.urls import url 3 | 4 | app_name = 'redis_api' 5 | 6 | urlpatterns = [ 7 | 8 | url(r'^historical_data/(?P[A-Z,1-9]{2,5}_[A-Z]{3,4})$', 9 | historical_data.HistoricalDataAPI.as_view(), name='historical_data'), 10 | 11 | url(r'^ticker/(?P[A-Z,1-9]{2,5}_[A-Z]{3,4})$', 12 | price_volume.PriceVolumeAPI.as_view(), name='price_volume'), 13 | 14 | # url(r'^ticker/(?P[A-Z]{2,5}_[A-Z]{3,4})/SMA$', 15 | # sma.SMA.as_view(), name='sma'), 16 | 17 | ] 18 | -------------------------------------------------------------------------------- /apps/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/__init__.py -------------------------------------------------------------------------------- /apps/ai/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/ai/__init__.py -------------------------------------------------------------------------------- /apps/ai/management/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/ai/management/__init__.py -------------------------------------------------------------------------------- /apps/ai/management/commands/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/ai/management/commands/__init__.py -------------------------------------------------------------------------------- /apps/ai/migrations/0002_auto_20180330_0936.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-03-30 09:36 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('ai', '0001_initial'), 12 | ] 13 | 14 | operations = [ 15 | migrations.RenameField( 16 | model_name='annmodel', 17 | old_name='s3_file', 18 | new_name='s3_model_file', 19 | ), 20 | migrations.AddField( 21 | model_name='annmodel', 22 | name='s3_notebook_file', 23 | field=models.TextField(null=True), 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /apps/ai/migrations/0003_add_more_sources.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-04-17 15:02 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('ai', '0002_auto_20180330_0936'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='annmodel', 17 | name='source', 18 | field=models.SmallIntegerField(choices=[(0, 'poloniex'), (1, 'bittrex'), (2, 'binance'), (3, 'bitfinex'), (4, 'kucoin'), (5, 'gdax'), (6, 'hitbtc')]), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /apps/ai/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/ai/migrations/__init__.py -------------------------------------------------------------------------------- /apps/ai/models/__init__.py: -------------------------------------------------------------------------------- 1 | from apps.ai.models.nn_model import AnnModel 2 | 3 | __all__ = [ 4 | AnnModel, 5 | ] -------------------------------------------------------------------------------- /apps/ai/settings/ai_preload.py: -------------------------------------------------------------------------------- 1 | import time 2 | from settings import SHORT, MEDIUM, LONG, RUN_ANN 3 | from apps.ai.models.nn_model import AnnModel, lookup_ann_model_object 4 | 5 | import logging 6 | logger = logging.getLogger(__name__) 7 | 8 | 9 | #MODEL_LIST = ["PRICE_PREDICT", "PRICE_MAXHIT"] # , "PRICE_MINHIT" 10 | 11 | 12 | MODEL_REF = { 13 | ("PRICE_PREDICT", SHORT) : 'lstm_short_60m_160_8_3class_return_0.03.h5', 14 | ("PRICE_PREDICT", MEDIUM) : 'lstm_medium_240m_100_12_3class_return_0.08.h5', 15 | ("PRICE_PREDICT", LONG) : 'lstm_model_2_2.h5', 16 | 17 | ("PRICE_MAXHIT", MEDIUM) : "lstm_medium_240m_120_8_maxhit2cl_0.05.h5" 18 | } 19 | 20 | 21 | MODELS_PRELOADED = {} 22 | start = time.time() 23 | 24 | logger.info(" >>>>> Start loading AI models... ") 25 | for model_name in MODEL_REF: 26 | ann_model_object = lookup_ann_model_object(MODEL_REF[model_name]) 27 | MODELS_PRELOADED[model_name] = ann_model_object 28 | 29 | logger.info(" ==== Finish loading AI models in time: " + str(time.time()-start) + " ====== ") 30 | -------------------------------------------------------------------------------- /apps/api/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/api/__init__.py -------------------------------------------------------------------------------- /apps/api/management/commands/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/api/management/commands/__init__.py -------------------------------------------------------------------------------- /apps/api/paginations.py: -------------------------------------------------------------------------------- 1 | from rest_framework.pagination import CursorPagination 2 | 3 | # http://www.django-rest-framework.org/api-guide/pagination/#cursorpagination 4 | 5 | class StandardResultsSetPagination(CursorPagination): 6 | page_size = 50 7 | ordering = ('-timestamp', '-id') 8 | page_size_query_param = 'page_size' 9 | max_page_size = 10000 10 | 11 | class StandardResultsSetPaginationOnlyTimestamp(CursorPagination): 12 | page_size = 50 13 | ordering = ('-timestamp') 14 | page_size_query_param = 'page_size' 15 | max_page_size = 10000 -------------------------------------------------------------------------------- /apps/api/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/api/tests/__init__.py -------------------------------------------------------------------------------- /apps/api/tests/test_api_v1.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | from apps.indicator.models import Price 4 | #from apps.channel.models.exchange_data import SOURCE_CHOICES 5 | 6 | from settings import SOURCE_CHOICES 7 | 8 | 9 | class PriceV1APITests(TestCase): 10 | pass -------------------------------------------------------------------------------- /apps/api/views/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/api/views/__init__.py -------------------------------------------------------------------------------- /apps/api/views/itt.py: -------------------------------------------------------------------------------- 1 | import ccxt 2 | import urllib.request, json 3 | 4 | from cache_memoize import cache_memoize 5 | 6 | from rest_framework.views import APIView 7 | from rest_framework.response import Response 8 | 9 | 10 | class ITTPriceView(APIView): 11 | """Return ITT price 12 | 13 | /api/v2/itt 14 | """ 15 | 16 | def get(self, request, format=None): 17 | # return Response(get_itt_token_price()) 18 | return Response(get_itt_token_price_from_ryptocompare_com()) 19 | 20 | 21 | # Helpers methods 22 | 23 | # Cache for 2 hours. 24 | @cache_memoize(2*60*60) 25 | def get_itt_token_price_from_ryptocompare_com(): 26 | with urllib.request.urlopen("https://min-api.cryptocompare.com/data/pricemulti?fsyms=ITT&tsyms=BTC,USD") as url: 27 | data = json.loads(url.read().decode()) 28 | return {'symbol': 'ITT/USD', 'close': data['ITT']['USD']} 29 | 30 | 31 | # Cache for 8 hours. 32 | @cache_memoize(8*60*60) 33 | def get_itt_token_price(): 34 | minimum_itt_price = 0.001 35 | 36 | ccap = ccxt.coinmarketcap() 37 | itt = ccap.fetch_ticker('ITT/USD') 38 | 39 | if itt['close'] < minimum_itt_price: 40 | itt_close = minimum_itt_price 41 | else: 42 | itt_close = itt['close'] 43 | return {'symbol': 'ITT/USD', 'close': itt_close, 'quoteVolume': itt['quoteVolume'], 'datetime': itt['datetime']} 44 | -------------------------------------------------------------------------------- /apps/api/views/rsi.py: -------------------------------------------------------------------------------- 1 | from rest_framework.generics import ListAPIView 2 | 3 | from apps.api.helpers import filter_queryset_by_timestamp 4 | from apps.api.paginations import StandardResultsSetPagination 5 | from apps.api.serializers import RsiSerializer 6 | 7 | 8 | # Mode: RSI 9 | class ListRsis(ListAPIView): 10 | """Return list of RSI. 11 | 12 | /api/v2/rsi/ 13 | 14 | URL query parameters 15 | 16 | For filtering 17 | 18 | transaction_currency -- string BTC, ETH etc 19 | counter_currency -- number 0=BTC, 1=ETH, 2=USDT, 3=XMR 20 | source -- number 0=poloniex, 1=bittrex, 2=binance 21 | resample_period -- in minutes, SHORT = 60 22 | startdate -- from this date (inclusive). Example 2018-02-12T09:09:15 23 | enddate -- to this date (inclusive) 24 | 25 | For pagination 26 | 27 | cursor - the pagination cursor value 28 | page_size -- a numeric value indicating the page size 29 | 30 | Examples 31 | 32 | /api/v2/rsi/?transaction_currency=BTC 33 | /api/v2/rsi/?startdate=2018-02-10T22:14:37&enddate=2018-01-26T11:08:30 34 | """ 35 | 36 | pagination_class = StandardResultsSetPagination 37 | serializer_class = RsiSerializer 38 | 39 | filter_fields = ('source', 'resample_period', 'transaction_currency', 'counter_currency') 40 | 41 | model = serializer_class.Meta.model 42 | 43 | def get_queryset(self): 44 | queryset = filter_queryset_by_timestamp(self) 45 | return queryset 46 | -------------------------------------------------------------------------------- /apps/api/views/sentiment.py: -------------------------------------------------------------------------------- 1 | from rest_framework.generics import ListAPIView 2 | 3 | from apps.api.serializers import SentimentSerializer 4 | from apps.api.paginations import StandardResultsSetPagination 5 | 6 | from apps.api.helpers import filter_queryset_by_timestamp 7 | 8 | 9 | 10 | class SentimentClassification(ListAPIView): 11 | 12 | pagination_class = StandardResultsSetPagination 13 | serializer_class = SentimentSerializer 14 | filter_fields = ('sentiment_source', 'topic', 'model', 'timestamp') 15 | 16 | model = serializer_class.Meta.model 17 | 18 | def get_queryset(self): 19 | return filter_queryset_by_timestamp(self) 20 | 21 | -------------------------------------------------------------------------------- /apps/api/views/v1_volume.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from django.http import HttpResponse 4 | from django.views.generic import View 5 | 6 | from apps.indicator.models import Volume as VolumeModel 7 | 8 | 9 | class Volume(View): 10 | def dispatch(self, request, *args, **kwargs): 11 | return super(Volume, self).dispatch(request, *args, **kwargs) 12 | 13 | 14 | def get(self, request, *args, **kwargs): 15 | 16 | transaction_currency = request.GET.get('transaction_currency', 'NA').upper() 17 | 18 | if transaction_currency == 'NA': 19 | return HttpResponse(json.dumps({'error': 'transaction_currency parameter is required'}), 20 | content_type="application/json") 21 | 22 | assert len(transaction_currency) > 1 23 | assert len(transaction_currency) < 8 24 | 25 | volume_data = VolumeModel.objects.filter(transaction_currency=transaction_currency 26 | ).order_by('-timestamp').first() 27 | if volume_data: 28 | response = { 29 | 'volume': volume_data.volume if transaction_currency is not "BTC" else volume_data.usdt, 30 | 'timestamp': str(volume_data.timestamp) 31 | } 32 | else: 33 | response = { 34 | 'error': "Coin not found" 35 | } 36 | 37 | return HttpResponse(json.dumps(response), content_type="application/json") 38 | -------------------------------------------------------------------------------- /apps/backtesting/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/backtesting/__init__.py -------------------------------------------------------------------------------- /apps/backtesting/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-04-12 12:23 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import django.db.models.deletion 7 | import unixtimestampfield.fields 8 | 9 | 10 | class Migration(migrations.Migration): 11 | 12 | initial = True 13 | 14 | dependencies = [ 15 | ('strategy', '0001_initial'), 16 | ] 17 | 18 | operations = [ 19 | migrations.CreateModel( 20 | name='BackTest', 21 | fields=[ 22 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 23 | ('timestamp', unixtimestampfield.fields.UnixTimeStampField()), 24 | ('strategy_name', models.CharField(max_length=32)), 25 | ('backtested_performance', models.FloatField(null=True)), 26 | ('strategy', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='strategy.Strategy')), 27 | ], 28 | ), 29 | ] 30 | -------------------------------------------------------------------------------- /apps/backtesting/migrations/0002_auto_20180416_1542.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-04-16 15:42 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('backtesting', '0001_initial'), 12 | ] 13 | 14 | operations = [ 15 | migrations.RenameField( 16 | model_name='backtest', 17 | old_name='backtested_performance', 18 | new_name='backtested_performance_1', 19 | ), 20 | migrations.RemoveField( 21 | model_name='backtest', 22 | name='strategy', 23 | ), 24 | migrations.RemoveField( 25 | model_name='backtest', 26 | name='strategy_name', 27 | ), 28 | migrations.AddField( 29 | model_name='backtest', 30 | name='backtested_performance_2', 31 | field=models.FloatField(null=True), 32 | ), 33 | migrations.AddField( 34 | model_name='backtest', 35 | name='strategy_class_name', 36 | field=models.CharField(max_length=64, null=True), 37 | ), 38 | ] 39 | -------------------------------------------------------------------------------- /apps/backtesting/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/backtesting/migrations/__init__.py -------------------------------------------------------------------------------- /apps/backtesting/models/__init__.py: -------------------------------------------------------------------------------- 1 | from apps.backtesting.models.back_test import BackTest 2 | 3 | __all__ = [ 4 | BackTest, 5 | ] 6 | 7 | -------------------------------------------------------------------------------- /apps/channel/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/channel/__init__.py -------------------------------------------------------------------------------- /apps/channel/management/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/channel/management/__init__.py -------------------------------------------------------------------------------- /apps/channel/management/commands/README.md: -------------------------------------------------------------------------------- 1 | # Channel.management.commands 2 | 3 | * `python manage.py poll_queue` 4 | 5 | Read price information from SQS queue (INCOMING_SQS_QUEUE) and save it to Price, Volume (messages with subject: prices_volumes) and PriceHistory (subject: ohlc_prices) models. 6 | 7 | Note: we should remove fetching and saving prices to the Price, Volume in future when a transition to PriceHistory will be completed. 8 | 9 | Add `pollqueue: python manage.py poll_queue` to Procfile if you use Heroku. 10 | 11 | * `python manage.py trawl_poloniex` 12 | 13 | Use it for debugging. It run some calculations w/o Celery. 14 |
15 | manage.py trawl_poloniex , where :
16 |     * compute_indicators - compute indicators for poloniex (default)
17 |     * compute_pair - BTC/USDT only 
18 |     * backtest - backtest all strategies
19 |     * ann - BE VERY VERY CAREFUL WITH THAT!!!! Because AI is our biggest existential threat.
20 | 
21 | 22 | 23 | * `python manage.py import_from_tob_history_csv` 24 | 25 | Read prices (open, high, low, close) from CSV files with historical prices, provided by Tobias and stored in S3 bucket 'intelligenttrading-historical-dump'. 26 | 27 | * `python manage.py import_from_channel_exchangedata_csv` 28 | 29 | Import historical prices from ExchangeData model (from Core and Data App) stored in CSV file. 30 | 31 | * `python manage.py try_taliv` 32 | 33 | Simple check if TA-Lib library installed and working. -------------------------------------------------------------------------------- /apps/channel/management/commands/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/channel/management/commands/__init__.py -------------------------------------------------------------------------------- /apps/channel/management/commands/try_talib.py: -------------------------------------------------------------------------------- 1 | from django.core.management.base import BaseCommand 2 | 3 | 4 | 5 | class Command(BaseCommand): 6 | help = "Try if Talib works" 7 | 8 | def handle(self, *args, **options): 9 | import numpy 10 | import talib 11 | 12 | close = numpy.random.random(100) 13 | output = talib.SMA(close) 14 | print(output) 15 | -------------------------------------------------------------------------------- /apps/channel/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2017-10-13 05:07 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import unixtimestampfield.fields 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | initial = True 12 | 13 | dependencies = [ 14 | ] 15 | 16 | operations = [ 17 | migrations.CreateModel( 18 | name='ExchangeData', 19 | fields=[ 20 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 21 | ('source', models.SmallIntegerField(choices=[(0, 'poloniex'), (1, 'bittrex')])), 22 | ('data', models.TextField(default='')), 23 | ('timestamp', unixtimestampfield.fields.UnixTimeStampField()), 24 | ], 25 | ), 26 | ] 27 | -------------------------------------------------------------------------------- /apps/channel/migrations/0002_add_more_sources.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-04-17 15:02 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('channel', '0001_initial'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='exchangedata', 17 | name='source', 18 | field=models.SmallIntegerField(choices=[(0, 'poloniex'), (1, 'bittrex'), (2, 'binance'), (3, 'bitfinex'), (4, 'kucoin'), (5, 'gdax'), (6, 'hitbtc')]), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /apps/channel/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/channel/migrations/__init__.py -------------------------------------------------------------------------------- /apps/channel/models/__init__.py: -------------------------------------------------------------------------------- 1 | from apps.channel.models.exchange_data import ExchangeData 2 | 3 | __all__ = [ 4 | "ExchangeData", 5 | ] 6 | -------------------------------------------------------------------------------- /apps/channel/models/exchange_data.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from django.contrib.postgres.fields import JSONField 3 | from unixtimestampfield.fields import UnixTimeStampField 4 | 5 | from settings import SOURCE_CHOICES 6 | 7 | 8 | # (POLONIEX, BITTREX) = list(range(2)) 9 | # SOURCE_CHOICES = ( 10 | # (POLONIEX, 'poloniex'), 11 | # (BITTREX, 'bittrex'), 12 | # ) 13 | 14 | 15 | class ExchangeData(models.Model): 16 | source = models.SmallIntegerField(choices=SOURCE_CHOICES, null=False) 17 | data = models.TextField(default="") 18 | timestamp = UnixTimeStampField(null=False) 19 | 20 | 21 | # MODEL PROPERTIES 22 | 23 | # MODEL FUNCTIONS 24 | -------------------------------------------------------------------------------- /apps/common/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/common/__init__.py -------------------------------------------------------------------------------- /apps/common/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from apps.common import models 3 | 4 | -------------------------------------------------------------------------------- /apps/common/behaviors/__init__.py: -------------------------------------------------------------------------------- 1 | from apps.common.behaviors.expirable import Expirable 2 | from apps.common.behaviors.publishable import Publishable 3 | from apps.common.behaviors.timestampable import Timestampable 4 | from apps.common.behaviors.locatable import Locatable 5 | from apps.common.behaviors.authorable import Authorable 6 | from apps.common.behaviors.annotatable import Annotatable 7 | from apps.common.behaviors.uploadable import Uploadable 8 | 9 | __all__ = [ 10 | Expirable, 11 | Publishable, 12 | Timestampable, 13 | Locatable, 14 | Authorable, 15 | Annotatable, 16 | Uploadable, 17 | ] 18 | -------------------------------------------------------------------------------- /apps/common/behaviors/annotatable.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | 4 | class Annotatable(models.Model): 5 | notes = models.ManyToManyField('common.Note') 6 | 7 | @property 8 | def has_notes(self): 9 | return True if self.notes.count() else False 10 | 11 | class Meta: 12 | abstract = True 13 | -------------------------------------------------------------------------------- /apps/common/behaviors/authorable.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from settings import AUTH_USER_MODEL 3 | 4 | 5 | class Authorable(models.Model): 6 | author = models.ForeignKey(AUTH_USER_MODEL, related_name="%(class)ss", on_delete=models.CASCADE) 7 | author_anonymous = models.BooleanField(default=False) 8 | authored_at = models.DateTimeField(null=True, blank=True) 9 | 10 | 11 | @property 12 | def author_display_name(self): 13 | if self.author_anonymous: 14 | return "Anonymous" 15 | else: 16 | return self.author.full_name 17 | 18 | 19 | class Meta: 20 | abstract = True 21 | -------------------------------------------------------------------------------- /apps/common/behaviors/expirable.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | 4 | class Expirable(models.Model): 5 | 6 | valid_at = models.DateTimeField(null=True, blank=True) 7 | expired_at = models.DateTimeField(null=True, blank=True) 8 | 9 | @property 10 | def is_expired(self): 11 | from django.utils.timezone import now 12 | return True if self.expired_at and self.expired_at < now() else False 13 | 14 | class Meta: 15 | abstract = True 16 | -------------------------------------------------------------------------------- /apps/common/behaviors/locatable.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | 4 | class Locatable(models.Model): 5 | 6 | address = models.ForeignKey('common.Address', null=True, on_delete=models.SET_NULL) 7 | 8 | longitude = models.FloatField(null=True) 9 | latitude = models.FloatField(null=True) 10 | 11 | class Meta: 12 | abstract = True 13 | -------------------------------------------------------------------------------- /apps/common/behaviors/publishable.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from django.utils import timezone 3 | 4 | 5 | class Publishable(models.Model): 6 | 7 | published_at = models.DateTimeField(null=True, blank=True) 8 | edited_at = models.DateTimeField(null=True, blank=True) 9 | unpublished_at = models.DateTimeField(null=True, blank=True) 10 | 11 | class Meta: 12 | abstract = True 13 | 14 | @property 15 | def is_published(self): 16 | now = timezone.now() 17 | if (self.published_at and self.published_at < now 18 | and not (self.unpublished_at and self.unpublished_at < now)): 19 | return True 20 | else: 21 | return False 22 | -------------------------------------------------------------------------------- /apps/common/behaviors/timestampable.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | 4 | class Timestampable(models.Model): 5 | created_at = models.DateTimeField(auto_now_add=True) 6 | modified_at = models.DateTimeField(auto_now=True) 7 | 8 | class Meta: 9 | abstract = True 10 | -------------------------------------------------------------------------------- /apps/common/forms/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/common/forms/__init__.py -------------------------------------------------------------------------------- /apps/common/migrations/0002_auto_20181018_2026.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.1.2 on 2018-10-18 20:26 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('common', '0001_initial'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='address', 16 | name='country', 17 | field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='addresses', to='common.Country'), 18 | ), 19 | migrations.AlterField( 20 | model_name='country', 21 | name='currency', 22 | field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='countries', to='common.Currency'), 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /apps/common/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/common/migrations/__init__.py -------------------------------------------------------------------------------- /apps/common/models/__init__.py: -------------------------------------------------------------------------------- 1 | from apps.common.models.currency import Currency 2 | from apps.common.models.country import Country 3 | from apps.common.models.address import Address 4 | from apps.common.models.note import Note 5 | from apps.common.models.document import Document 6 | from apps.common.models.image import Image 7 | 8 | __all__ = [ 9 | Currency, 10 | Country, 11 | Address, 12 | Note, 13 | Document, 14 | Image, 15 | ] 16 | -------------------------------------------------------------------------------- /apps/common/models/address.py: -------------------------------------------------------------------------------- 1 | import uuid 2 | from django.db import models 3 | from apps.common.behaviors.timestampable import Timestampable 4 | 5 | 6 | class Address(Timestampable, models.Model): 7 | 8 | id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) 9 | line_1 = models.CharField(max_length=100, null=True, blank=True) 10 | line_2 = models.CharField(max_length=100, null=True, blank=True) 11 | line_3 = models.CharField(max_length=100, null=True, blank=True) 12 | city = models.CharField(max_length=35, null=True, blank=True) 13 | region = models.CharField(max_length=35, null=True, blank=True) 14 | postal_code = models.CharField(max_length=10, null=True, blank=True) 15 | country = models.ForeignKey('common.Country', related_name='addresses', 16 | null=True, on_delete=models.SET_NULL) 17 | 18 | # MODEL PROPERTIES 19 | @property 20 | def inline_string(self): 21 | string = "%s " % self.line_1 22 | string += "%s" % self.city or "" 23 | string += ", %s " % self.region or "" 24 | return string 25 | 26 | @property 27 | def google_map_url(self): 28 | return "http://maps.google.com/?q=%s" % self.inline_string.replace( 29 | " ", "%20") 30 | 31 | # MODEL FUNCTIONS 32 | def __str__(self): 33 | return str(self.inline_string) 34 | 35 | class Meta: 36 | verbose_name_plural = 'addresses' 37 | -------------------------------------------------------------------------------- /apps/common/models/country.py: -------------------------------------------------------------------------------- 1 | import uuid 2 | from django.db import models 3 | 4 | 5 | class Country( 6 | models.Model): # could expand on pypi.python.org/pypi/django-countries 7 | 8 | id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) 9 | name = models.CharField(max_length=100, blank=True) 10 | code = models.CharField(max_length=3, blank=True) 11 | calling_code = models.CharField(max_length=3, blank=True) 12 | 13 | # assuming countries stick to one currency nationwide 14 | currency = models.ForeignKey('common.Currency', related_name='countries', 15 | null=True, on_delete=models.SET_NULL) 16 | 17 | # MODEL PROPERTIES 18 | 19 | # MODEL FUNCTIONS 20 | def __str__(self): 21 | return str(self.code) 22 | 23 | class Meta: 24 | verbose_name_plural = 'countries' 25 | -------------------------------------------------------------------------------- /apps/common/models/currency.py: -------------------------------------------------------------------------------- 1 | import uuid 2 | from django.db import models 3 | from apps.common.behaviors import Timestampable 4 | 5 | 6 | class Currency(Timestampable, models.Model): 7 | 8 | id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) 9 | name = models.CharField(max_length=255) 10 | code = models.CharField(max_length=8) 11 | 12 | # MODEL PROPERTIES 13 | 14 | # MODEL FUNCTIONS 15 | def __str__(self): 16 | return str(self.code) 17 | -------------------------------------------------------------------------------- /apps/common/models/document.py: -------------------------------------------------------------------------------- 1 | from apps.common.behaviors import Uploadable, Timestampable 2 | 3 | accepted_file_types = ['pdf', 'doc', 'docx', 'rtf', 'pages'] 4 | 5 | 6 | class Document(Uploadable, Timestampable): 7 | # https://django-polymorphic.readthedocs.io/en/latest/ 8 | 9 | @property 10 | def display(self): 11 | """ 12 | Implemented by sub-classes 13 | :return: string containing the HTML to display for this document 14 | """ 15 | pass 16 | 17 | 18 | class PDF(Document): 19 | @property 20 | def display(self): 21 | return "PDF Document" 22 | 23 | 24 | def create(ext): 25 | """ 26 | Factory function. Creates a database object, saves. 27 | :param ext: file extension 28 | :return: Depends on extension 29 | """ 30 | ext = ext.lower() 31 | if ext == accepted_file_types[0]: 32 | pdf = PDF.objects.create() 33 | return pdf 34 | -------------------------------------------------------------------------------- /apps/common/models/image.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from apps.common.behaviors import Uploadable, Timestampable 3 | 4 | ACCEPTED_FILE_TYPES = ['jpg', 'gif', 'png'] 5 | 6 | 7 | class Image(Uploadable, Timestampable): 8 | 9 | thumbnail_url = models.URLField(default="", null=True, blank=True) 10 | 11 | # MODEL PROPERTIES 12 | @property 13 | def width(self): 14 | if self.is_image: 15 | return self.meta_data['meta'].get('width') if self.meta_data.get( 16 | 'meta') else None 17 | 18 | @property 19 | def height(self): 20 | if self.is_image: 21 | return self.meta_data['meta'].get('height') if self.meta_data.get( 22 | 'meta') else None 23 | -------------------------------------------------------------------------------- /apps/common/models/note.py: -------------------------------------------------------------------------------- 1 | import uuid 2 | from django.db import models 3 | from apps.common.behaviors import Timestampable, Authorable 4 | 5 | 6 | class Note(Timestampable, Authorable, models.Model): 7 | 8 | id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) 9 | text = models.TextField(default="", blank=True) 10 | 11 | # MODEL PROPERTIES 12 | 13 | # MODEL FUNCTIONS 14 | -------------------------------------------------------------------------------- /apps/common/templates/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/common/templates/__init__.py -------------------------------------------------------------------------------- /apps/common/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/common/tests/__init__.py -------------------------------------------------------------------------------- /apps/common/tests/test_behaviors/__init__.py: -------------------------------------------------------------------------------- 1 | from .test_authorable import AuthorableTest 2 | from .test_locatable import LocatableTest 3 | from .test_publishable import PublishableTest 4 | from .test_timestampable import TimestampableTest 5 | from .test_uploadable import UploadableTest 6 | 7 | __all__ = [ 8 | 'AuthorableTest', 'LocatableTest', 9 | 'TimestampableTest', 'UploadableTest', 10 | 'PublishableTest' 11 | ] 12 | -------------------------------------------------------------------------------- /apps/common/tests/test_behaviors/test_authorable.py: -------------------------------------------------------------------------------- 1 | import mock 2 | 3 | from django.utils import timezone 4 | 5 | from .test_mixins import BehaviorTestCaseMixin 6 | 7 | 8 | class AuthorableTest(BehaviorTestCaseMixin): 9 | def test_save_authored_at_should_store_data_correctly(self): 10 | now = timezone.now() 11 | 12 | with mock.patch('django.utils.timezone.now') as mock_now: 13 | mock_now.return_value = now 14 | obj = self.create_instance(authored_at=now) 15 | self.assertEqual(obj.authored_at, now) 16 | 17 | def test_should_create_author_correctly(self): 18 | obj = self.create_instance() 19 | self.assertEqual(obj.author, self.person.user) 20 | -------------------------------------------------------------------------------- /apps/common/tests/test_behaviors/test_locatable.py: -------------------------------------------------------------------------------- 1 | from .test_mixins import BehaviorTestCaseMixin 2 | from ...models import Address 3 | 4 | 5 | class LocatableTest(BehaviorTestCaseMixin): 6 | def test_should_save_address_logtitude_latitude_correctly(self): 7 | address = Address.objects.create() 8 | obj = self.create_instance( 9 | address=address, 10 | latitude="10", 11 | longitude="20" 12 | ) 13 | self.assertEqual(obj.address, address) 14 | self.assertEqual(obj.latitude, "10") 15 | self.assertEqual(obj.longitude, "20") 16 | -------------------------------------------------------------------------------- /apps/common/tests/test_behaviors/test_mixins.py: -------------------------------------------------------------------------------- 1 | class BehaviorTestCaseMixin(object): 2 | @property 3 | def model(self): 4 | raise NotImplementedError("Implement Me") 5 | 6 | def create_instance(self, **kwargs): 7 | return self.model.objects.create(**kwargs) 8 | -------------------------------------------------------------------------------- /apps/common/tests/test_models/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/common/tests/test_models/__init__.py -------------------------------------------------------------------------------- /apps/common/tests/test_models/test_address.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | from ..test_behaviors import TimestampableTest 4 | from ...models import Address 5 | 6 | 7 | class AddressTest(TimestampableTest, TestCase): 8 | model = Address 9 | -------------------------------------------------------------------------------- /apps/common/tests/test_models/test_currency.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | from ..test_behaviors import TimestampableTest 4 | from ...models import Currency 5 | 6 | 7 | class CurrencyTest(TimestampableTest, TestCase): 8 | model = Currency 9 | -------------------------------------------------------------------------------- /apps/common/tests/test_models/test_image.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | from ..test_behaviors import UploadableTest 4 | from ...models import Image 5 | 6 | 7 | class ImageTest(UploadableTest, TestCase): 8 | model = Image 9 | -------------------------------------------------------------------------------- /apps/common/utilities/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/common/utilities/__init__.py -------------------------------------------------------------------------------- /apps/common/utilities/db.py: -------------------------------------------------------------------------------- 1 | import typing 2 | from typing import List, Tuple 3 | from enum import Enum 4 | 5 | 6 | def enum_to_choices(enum: Enum) -> List[Tuple[int, str]]: 7 | return [(i.value, i.name) for i in enum] 8 | -------------------------------------------------------------------------------- /apps/common/utilities/email.py: -------------------------------------------------------------------------------- 1 | from django.core.mail import EmailMessage 2 | 3 | 4 | def email_to_string(e): 5 | # type: (EmailMessage) -> str 6 | def n(x): 7 | x or 'Not specified' 8 | 9 | return """ 10 | From: {} 11 | To: {} 12 | Subject: {} 13 | Reply-To: {} 14 | CC: {} 15 | BCC: {} 16 | Body: {} 17 | Attachments: {} 18 | """.format( 19 | n(e.from_email), 20 | n(e.to), 21 | n(e.subject), 22 | n(e.reply_to), n(e.cc), n(e.bcc), n(e.body), n(str(e.attachments))) 23 | -------------------------------------------------------------------------------- /apps/common/utilities/english_language.py: -------------------------------------------------------------------------------- 1 | import string 2 | 3 | # MODEL FUNCTIONS 4 | def build_english_list(items): 5 | result = '' 6 | 7 | if len(items) == 0: 8 | return result 9 | 10 | if len(items) == 1: 11 | return items[0] 12 | 13 | if len(items) == 2: 14 | return items[0] + " and " + items[1] 15 | 16 | for i, item in enumerate(items): 17 | item = item.strip() 18 | 19 | # If last one. 20 | if i + 1 == len(items): 21 | result += "and " + item 22 | else: 23 | result += item + ", " 24 | 25 | return result 26 | 27 | 28 | def cap_first_word(arg): 29 | if type(arg) == str: 30 | s = arg.strip() 31 | return s[0].upper() + s[1:None] 32 | 33 | if type(arg) == list: 34 | return [string.capwords(arg[0])] + arg[1:None] 35 | 36 | raise TypeError("Invalid type passed to function: " + type(arg)) 37 | 38 | 39 | def last_char(s): 40 | return s[len(s) - 1] 41 | 42 | 43 | def ends_with_period(s): 44 | return bool(s[-1:] == ".") 45 | -------------------------------------------------------------------------------- /apps/common/utilities/logger.py: -------------------------------------------------------------------------------- 1 | # import the logging library 2 | import logging 3 | 4 | # Get an instance of a logger 5 | logger = logging.getLogger(__name__) 6 | -------------------------------------------------------------------------------- /apps/common/utilities/model_fields.py: -------------------------------------------------------------------------------- 1 | from django.core.exceptions import ValidationError 2 | from django.db import models 3 | 4 | 5 | # https://djangosnippets.org/snippets/1741/ 6 | # http://stackoverflow.com/questions/28529179/django-creating-a-custom-model-field 7 | class MoneyField(models.IntegerField): 8 | description = "A field to save a currency as cents(int) " 9 | description += "in db, but act like a float" 10 | 11 | def get_db_prep_value(self, value, *args, **kwargs): 12 | if value is None: 13 | return None 14 | return int(round(value * 100)) 15 | 16 | def to_python(self, value): 17 | if value is None or isinstance(value, float): 18 | return value 19 | try: 20 | return float(value) / 100 21 | except (TypeError, ValueError): 22 | msg = "This value must be an integer or a " 23 | msg += "string represents an integer." 24 | raise ValidationError( 25 | msg 26 | ) 27 | 28 | def from_db_value(self, value, expression, connection, context): 29 | return self.to_python(value) 30 | 31 | def formfield(self, **kwargs): 32 | from django.forms import FloatField 33 | defaults = {'form_class': FloatField} 34 | defaults.update(kwargs) 35 | return super(MoneyField, self).formfield(**defaults) 36 | -------------------------------------------------------------------------------- /apps/common/utilities/multithreading.py: -------------------------------------------------------------------------------- 1 | # A DECORATOR FOR PYTHON THREADING 2 | # http://docs.python.org/2/library/threading.html#thread-objects 3 | # http://stackoverflow.com/questions/18420699/multithreading-for-python-django 4 | from threading import Thread 5 | 6 | def start_new_thread(function): 7 | def decorator(*args, **kwargs): 8 | t = Thread(target = function, args=args, kwargs=kwargs) 9 | t.daemon = True 10 | t.start() 11 | return decorator 12 | 13 | 14 | def run_all_multithreaded(function_def, list_of_params): 15 | """ 16 | :param function_def: the function to pass params to 17 | :param list_of_params: list of function params, for multiple-param functions, pass tuples 18 | :return: 19 | """ 20 | 21 | from multiprocessing.dummy import Pool as ThreadPool 22 | 23 | # make the Pool of workers 24 | pool = ThreadPool(16) 25 | 26 | # open functions in their own threads 27 | # and compile all the results 28 | results = pool.map(function_def, list_of_params) 29 | 30 | # close the pool and wait for the work to finish 31 | pool.close() 32 | pool.join() 33 | 34 | return results 35 | -------------------------------------------------------------------------------- /apps/common/utilities/regex.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | 4 | # EXTRACT EMAIL WITH REGEX 5 | def extractEmail(string, return_all=True): 6 | regex = re.compile( 7 | ("([a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`" 8 | "{|}~-]+)*(@|\sat\s)(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(\.|" 9 | "\sdot\s))+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)")) 10 | 11 | emails = [email[0] for email in re.findall(regex, string.lower()) 12 | if not email[0].startswith('//')] 13 | if len(emails): 14 | return emails if return_all else emails[0] 15 | -------------------------------------------------------------------------------- /apps/common/utilities/s3.py: -------------------------------------------------------------------------------- 1 | import boto 2 | from settings import AWS_OPTIONS, DEFAULT_FILE_STORAGE 3 | import logging 4 | logger = logging.getLogger(__name__) 5 | 6 | def get_readable_stream(s3_key): 7 | s3_key.open_read() 8 | return s3_key.read() 9 | 10 | 11 | def get_s3_key(bucket_name: str, key_name: str): 12 | # returns boto.s3.key 13 | return boto.connect_s3().get_bucket(bucket_name).get_key(key_name) 14 | 15 | 16 | def get_s3_readable_key(bucket_name: str, key_name: str): 17 | return get_readable_stream(get_s3_key(bucket_name, key_name)) 18 | 19 | 20 | def create_public_url(s3_key) -> str: 21 | s3_key.set_acl('public-read') 22 | return s3_key.generate_url(expires_in=0, query_auth=False) 23 | 24 | # added by @AlexY for downloading a keras model 25 | def download_file_from_s3(s3filename): 26 | conn = boto.s3.connect_to_region("us-east-1", 27 | aws_access_key_id=AWS_OPTIONS['AWS_ACCESS_KEY_ID'], 28 | aws_secret_access_key=AWS_OPTIONS['AWS_SECRET_ACCESS_KEY']) 29 | 30 | bucket = conn.get_bucket(AWS_OPTIONS['AWS_STORAGE_BUCKET_NAME']) 31 | key_obj = boto.s3.key.Key(bucket) 32 | key_obj.key = s3filename 33 | 34 | contents = key_obj.get_contents_to_filename(s3filename) 35 | -------------------------------------------------------------------------------- /apps/common/utilities/sqs.py: -------------------------------------------------------------------------------- 1 | import boto 2 | from settings import AWS_OPTIONS, DEFAULT_FILE_STORAGE 3 | from boto.sqs.message import Message 4 | import json 5 | from settings import QUEUE_NAME, AWS_OPTIONS, BETA_QUEUE_NAME, TEST_QUEUE_NAME 6 | 7 | import logging 8 | logger = logging.getLogger(__name__) 9 | 10 | 11 | def send_sqs(dictionary): 12 | message = Message() 13 | message.set_body(json.dumps(dictionary)) 14 | 15 | sqs_connection = boto.sqs.connect_to_region("us-east-1", 16 | aws_access_key_id=AWS_OPTIONS['AWS_ACCESS_KEY_ID'], 17 | aws_secret_access_key=AWS_OPTIONS['AWS_SECRET_ACCESS_KEY']) 18 | 19 | if QUEUE_NAME: 20 | logging.debug("emitted to QUEUE_NAME queue :" + QUEUE_NAME) 21 | production_queue = sqs_connection.get_queue(QUEUE_NAME) 22 | production_queue.write(message) 23 | 24 | if BETA_QUEUE_NAME: 25 | logging.debug("emitted to BETA_QUEUE_NAME queue :" + BETA_QUEUE_NAME) 26 | test_queue = sqs_connection.get_queue(BETA_QUEUE_NAME) 27 | test_queue.write(message) 28 | 29 | if TEST_QUEUE_NAME: 30 | logging.debug("emitted to TEST_QUEUE_NAME queue :" + TEST_QUEUE_NAME) 31 | test_queue = sqs_connection.get_queue(TEST_QUEUE_NAME) 32 | test_queue.write(message) 33 | 34 | logger.info("EMITTED SIGNAL: " + str(dictionary)) -------------------------------------------------------------------------------- /apps/common/utilities/unicode_tools.py: -------------------------------------------------------------------------------- 1 | import typing 2 | from typing import List, Callable 3 | import unicodedata 4 | import re 5 | import toolz 6 | from toolz import complement # "flips" result of function, i.e. True == False 7 | 8 | 9 | # Removes all control characters - Including line feeds and carriage returns. 10 | def clean_text(text: str) -> str: 11 | return filter_text(text, complement(is_control_char)) 12 | 13 | 14 | def filter_text(text: str, filters: List[Callable[[str], bool]]) -> str: 15 | # Applies the filters in the order given 16 | return "".join(list(filter(lambda c: toolz.pipe(c, filters), text))) 17 | # return "".join(list(filter(lambda x: ord(x) == 32 or 32 < ord(x) < 127, 18 | # text))) 19 | 20 | 21 | def is_control_char(ch: str) -> bool: 22 | return unicodedata.category(ch)[0] == "C" 23 | 24 | 25 | def remove_control_chars(string): 26 | return "".join(list(filter(complement(is_control_char), string))) 27 | 28 | 29 | def remove_html_tags(s: str) -> str: 30 | return re.sub("(?i)<(?!img|/img).*?>", "", s).strip() 31 | -------------------------------------------------------------------------------- /apps/common/utilities/whois.py: -------------------------------------------------------------------------------- 1 | import whois 2 | import logging 3 | logger = logging.getLogger(__name__) 4 | 5 | def get_domain_owner_emails(domain): 6 | w = whois.whois(domain) 7 | try: 8 | return w.emails 9 | except Exception as e: 10 | logger.debug("error searching for domain emails: %s" % str(e)) 11 | return [] 12 | -------------------------------------------------------------------------------- /apps/common/views/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/common/views/__init__.py -------------------------------------------------------------------------------- /apps/dashboard/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/dashboard/__init__.py -------------------------------------------------------------------------------- /apps/dashboard/static/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/dashboard/static/__init__.py -------------------------------------------------------------------------------- /apps/dashboard/templates/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/dashboard/templates/__init__.py -------------------------------------------------------------------------------- /apps/dashboard/templates/inclusions/signal.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |

4 | {{ signal.signal }} 5 | 6 | {% if signal.signal == "RSI" %}{{ signal.rsi_value }}{% endif %} 7 | 8 | 9 | {% if signal.trend > 0 %}BULLISH{% else %}BEARISH{% endif %} 10 | 11 |

12 | 13 | 14 | {{ signal.get_horizon_display }} horizon 15 | 16 | 17 | on {{ signal.get_source_display }} 18 | 19 | 20 |
21 | -------------------------------------------------------------------------------- /apps/dashboard/templates/main.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load static %} 3 | 4 | {% block tab_title %} 5 | Main Dashboard 6 | {% endblock tab_title %} 7 | 8 | {% block content_title %} 9 | Main Dashboard 10 | {% endblock content_title %} 11 | 12 | {% block content %} 13 | 14 | {# {{ signals }}#} 15 | 16 | 17 | {% for signal_name, signal_stats in signals.items %} 18 | 19 |
20 | 21 | {% for horizon_name, horizon_stats in signal_stats.items %} 22 | 23 |
24 |
25 |

26 | {{ horizon_stats.num_signals_24_hrs }} 27 | 28 | {{ horizon_stats.num_signals_24_hrs_delta_percent|floatformat:1 }}% 29 | 30 |

31 | 32 | {% if horizon_name == "all" %} 33 | {{ signal_name }} (24hr) 34 | {% else %} 35 | {{ horizon_name }} {{ signal_name }} 36 | {% endif %} 37 | 38 |
39 |
40 | 41 | {% endfor %} 42 | 43 |
44 | 45 | {% endfor %} 46 | 47 | 48 | {% endblock content %} 49 | -------------------------------------------------------------------------------- /apps/dashboard/templates/market.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load static %} 3 | 4 | {% block tab_title %} 5 | ITF Dashboard 6 | {% endblock tab_title %} 7 | 8 | {% block content_title %} 9 | ITF Dashboard 10 | {% endblock content_title %} 11 | 12 | {% block content %} 13 | 14 | 15 |
16 |
17 | 18 | 28 |
29 | 30 | 31 | {% endblock content %} -------------------------------------------------------------------------------- /apps/dashboard/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url, include 2 | from django.views.decorators.cache import cache_page 3 | from apps.dashboard.views.main import Main 4 | # from apps.dashboard.views.market import Market 5 | from apps.dashboard.views.ticker import Ticker 6 | 7 | app_name = 'dashboard' 8 | 9 | urlpatterns = [ 10 | 11 | url(r'^$', cache_page(3600 * 4)(Main.as_view()), name='main'), 12 | 13 | # url(r'^market$', cache_page(3600 * 12)(Market.as_view()), name='main'), 14 | 15 | url(r'^ticker/(?P[-\w\.]+)$', cache_page(3600 * 1)(Ticker.as_view()), name='main'), 16 | 17 | ] 18 | -------------------------------------------------------------------------------- /apps/dashboard/views/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/dashboard/views/__init__.py -------------------------------------------------------------------------------- /apps/dashboard/views/market.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from django.views.generic import View 3 | 4 | 5 | class Market(View): 6 | def dispatch(self, request, *args, **kwargs): 7 | return super(Market, self).dispatch(request, *args, **kwargs) 8 | 9 | def get(self, request): 10 | context = {} 11 | return render(request, 'market.html', context) 12 | -------------------------------------------------------------------------------- /apps/indicator/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/indicator/__init__.py -------------------------------------------------------------------------------- /apps/indicator/management/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/indicator/management/__init__.py -------------------------------------------------------------------------------- /apps/indicator/management/commands/README.md: -------------------------------------------------------------------------------- 1 | # Indicator.management.commands 2 | 3 | * `python manage.py fill_price_history_missing_volumes` 4 | 5 | This command fills missing volumes in PriceHistory with data from Volume model. 6 | It starts with recent items from PriceHistory. 7 | You should use a parameter with a number of PriceHistory entries it should fill. 8 | This command uses DataFiller class from indicator.management.helpers. 9 | 10 | 11 | * `python manage.py fill_price_resampl_volume_history` 12 | 13 | This command fills missing volumes in PriceResampl with data from PriceHistory. 14 | It takes a parameter with a number of entries it should fill. 15 | -------------------------------------------------------------------------------- /apps/indicator/management/commands/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/indicator/management/commands/__init__.py -------------------------------------------------------------------------------- /apps/indicator/management/commands/hello_subscribers.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | from django.core.management.base import BaseCommand 4 | 5 | from apps.signal.models import Signal 6 | 7 | logger = logging.getLogger(__name__) 8 | 9 | 10 | class Command(BaseCommand): 11 | help = "Send a friendly greeting to all our subscribers." 12 | 13 | def handle(self, *args, **options): 14 | logger.info("Let's say hello to our subscribers...") 15 | alert = Signal(text="Hello traders! 😺 \n Did you buy Bitcoin today?") 16 | alert.send() 17 | -------------------------------------------------------------------------------- /apps/indicator/migrations/0002_priceresampled.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2017-10-26 10:01 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import unixtimestampfield.fields 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('indicator', '0001_initial'), 13 | ] 14 | 15 | operations = [ 16 | migrations.CreateModel( 17 | name='PriceResampled', 18 | fields=[ 19 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 20 | ('source', models.SmallIntegerField(choices=[(0, 'poloniex'), (1, 'bittrex')])), 21 | ('coin', models.CharField(max_length=6)), 22 | ('timestamp', unixtimestampfield.fields.UnixTimeStampField()), 23 | ('period', models.PositiveSmallIntegerField(default=15)), 24 | ('mean_price_satoshis', models.IntegerField(null=True)), 25 | ('min_price_satoshis', models.IntegerField(null=True)), 26 | ('max_price_satoshis', models.IntegerField(null=True)), 27 | ('SMA50_satoshis', models.IntegerField(null=True)), 28 | ('SMA200_satoshis', models.IntegerField(null=True)), 29 | ], 30 | options={ 31 | 'abstract': False, 32 | }, 33 | ), 34 | ] 35 | -------------------------------------------------------------------------------- /apps/indicator/migrations/0003_auto_20171030_2155.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2017-10-30 21:55 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('indicator', '0002_priceresampled'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='priceresampled', 17 | name='EMA200_satoshis', 18 | field=models.IntegerField(null=True), 19 | ), 20 | migrations.AddField( 21 | model_name='priceresampled', 22 | name='EMA50_satoshis', 23 | field=models.IntegerField(null=True), 24 | ), 25 | migrations.AddField( 26 | model_name='priceresampled', 27 | name='relative_strength', 28 | field=models.FloatField(null=True), 29 | ), 30 | ] 31 | -------------------------------------------------------------------------------- /apps/indicator/migrations/0004_auto_20171104_1440.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2017-11-04 14:40 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('indicator', '0003_auto_20171030_2155'), 12 | ] 13 | 14 | operations = [ 15 | migrations.RenameField( 16 | model_name='price', 17 | old_name='satoshis', 18 | new_name='price_satoshis', 19 | ), 20 | migrations.RenameField( 21 | model_name='price', 22 | old_name='usdt', 23 | new_name='price_usdt', 24 | ), 25 | migrations.RenameField( 26 | model_name='price', 27 | old_name='wei', 28 | new_name='price_wei', 29 | ), 30 | ] 31 | -------------------------------------------------------------------------------- /apps/indicator/migrations/0006_auto_20171207_1348.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2017-12-07 13:48 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('indicator', '0005_auto_20171206_1053'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='priceresampled', 17 | name='closing_price', 18 | field=models.BigIntegerField(null=True), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /apps/indicator/migrations/0007_auto_20171207_1416.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2017-12-07 14:16 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('indicator', '0006_auto_20171207_1348'), 12 | ] 13 | 14 | operations = [ 15 | migrations.RenameField( 16 | model_name='volume', 17 | old_name='btc_volume', 18 | new_name='volume', 19 | ), 20 | migrations.AddField( 21 | model_name='volume', 22 | name='base_coin', 23 | field=models.SmallIntegerField(choices=[(0, 'BTC'), (1, 'ETH'), (2, 'USDT'), (3, 'XMR')], default=0), 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /apps/indicator/migrations/0008_auto_20171208_1127.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2017-12-08 11:27 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('indicator', '0007_auto_20171207_1416'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='priceresampled', 17 | name='max_price', 18 | field=models.BigIntegerField(null=True), 19 | ), 20 | migrations.AlterField( 21 | model_name='priceresampled', 22 | name='mean_price', 23 | field=models.BigIntegerField(null=True), 24 | ), 25 | migrations.AlterField( 26 | model_name='priceresampled', 27 | name='min_price', 28 | field=models.BigIntegerField(null=True), 29 | ), 30 | ] 31 | -------------------------------------------------------------------------------- /apps/indicator/migrations/0009_auto_20171208_1301.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2017-12-08 13:01 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('indicator', '0008_auto_20171208_1127'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='priceresampled', 17 | name='ema_high_price', 18 | field=models.BigIntegerField(null=True), 19 | ), 20 | migrations.AlterField( 21 | model_name='priceresampled', 22 | name='ema_low_price', 23 | field=models.BigIntegerField(null=True), 24 | ), 25 | migrations.AlterField( 26 | model_name='priceresampled', 27 | name='sma_high_price', 28 | field=models.BigIntegerField(null=True), 29 | ), 30 | migrations.AlterField( 31 | model_name='priceresampled', 32 | name='sma_low_price', 33 | field=models.BigIntegerField(null=True), 34 | ), 35 | ] 36 | -------------------------------------------------------------------------------- /apps/indicator/migrations/0010_auto_20171212_0252.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2017-12-12 02:52 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('indicator', '0009_auto_20171208_1301'), 12 | ] 13 | 14 | operations = [ 15 | migrations.RenameField( 16 | model_name='price', 17 | old_name='base_coin', 18 | new_name='counter_currency', 19 | ), 20 | migrations.RenameField( 21 | model_name='price', 22 | old_name='coin', 23 | new_name='transaction_currency', 24 | ), 25 | migrations.RenameField( 26 | model_name='priceresampled', 27 | old_name='base_coin', 28 | new_name='counter_currency', 29 | ), 30 | migrations.RenameField( 31 | model_name='priceresampled', 32 | old_name='coin', 33 | new_name='transaction_currency', 34 | ), 35 | migrations.RenameField( 36 | model_name='volume', 37 | old_name='base_coin', 38 | new_name='counter_currency', 39 | ), 40 | migrations.RenameField( 41 | model_name='volume', 42 | old_name='coin', 43 | new_name='transaction_currency', 44 | ), 45 | ] 46 | -------------------------------------------------------------------------------- /apps/indicator/migrations/0013_auto_20180330_0936.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-03-30 09:36 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('indicator', '0012_annpriceclassification'), 12 | ] 13 | 14 | operations = [ 15 | migrations.RenameField( 16 | model_name='annpriceclassification', 17 | old_name='nn_model', 18 | new_name='ann_model', 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /apps/indicator/migrations/0014_auto_20180330_1108.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-03-30 11:08 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('indicator', '0013_auto_20180330_0936'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='annpriceclassification', 17 | name='predicted_ahead_for', 18 | field=models.SmallIntegerField(null=True), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /apps/indicator/migrations/0015_delete_priceresampled.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-04-05 11:05 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('indicator', '0014_auto_20180330_1108'), 12 | ] 13 | 14 | operations = [ 15 | migrations.DeleteModel( 16 | name='PriceResampled', 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /apps/indicator/migrations/0017_add_indexes_to_price_sma_priceresampl.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-04-26 07:57 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('indicator', '0016_add_more_sources'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddIndex( 16 | model_name='price', 17 | index=models.Index(fields=['timestamp', 'source', 'transaction_currency', 'counter_currency'], name='indicator_p_timesta_29a5f2_idx'), 18 | ), 19 | migrations.AddIndex( 20 | model_name='priceresampl', 21 | index=models.Index(fields=['source', 'resample_period', 'counter_currency', 'transaction_currency'], name='indicator_p_source_61ed12_idx'), 22 | ), 23 | migrations.AddIndex( 24 | model_name='sma', 25 | index=models.Index(fields=['source', 'resample_period', 'counter_currency', 'transaction_currency', 'sma_period'], name='indicator_s_source_b04535_idx'), 26 | ), 27 | ] 28 | -------------------------------------------------------------------------------- /apps/indicator/migrations/0018_auto_20180608_1150.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-06-08 11:50 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('indicator', '0017_add_indexes_to_price_sma_priceresampl'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddIndex( 16 | model_name='eventselementary', 17 | index=models.Index(fields=['transaction_currency', 'source', 'counter_currency', 'resample_period', 'event_name', 'timestamp'], name='indicator_e_transac_b99fce_idx'), 18 | ), 19 | migrations.AddIndex( 20 | model_name='rsi', 21 | index=models.Index(fields=['transaction_currency', 'counter_currency', 'source', 'resample_period'], name='indicator_r_transac_c5b0e7_idx'), 22 | ), 23 | migrations.AddIndex( 24 | model_name='volume', 25 | index=models.Index(fields=['transaction_currency', 'counter_currency', 'source', 'timestamp'], name='indicator_v_transac_e2dbb6_idx'), 26 | ), 27 | ] 28 | -------------------------------------------------------------------------------- /apps/indicator/migrations/0019_auto_20180614_1013.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-06-14 10:13 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('indicator', '0018_auto_20180608_1150'), 12 | ] 13 | 14 | operations = [ 15 | migrations.RemoveIndex( 16 | model_name='priceresampl', 17 | name='indicator_p_source_61ed12_idx', 18 | ), 19 | migrations.AddIndex( 20 | model_name='priceresampl', 21 | index=models.Index(fields=['transaction_currency', 'counter_currency', 'source', 'resample_period'], name='indicator_p_transac_edf618_idx'), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /apps/indicator/migrations/0020_auto_20180615_1317.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-06-15 13:17 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('indicator', '0019_auto_20180614_1013'), 12 | ] 13 | 14 | operations = [ 15 | migrations.RemoveIndex( 16 | model_name='priceresampl', 17 | name='indicator_p_transac_edf618_idx', 18 | ), 19 | migrations.AddIndex( 20 | model_name='priceresampl', 21 | index=models.Index(fields=['transaction_currency', 'counter_currency', 'source', 'resample_period', 'timestamp'], name='indicator_p_transac_266f85_idx'), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /apps/indicator/migrations/0021_pricehistory.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-06-20 17:10 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('indicator', '0020_auto_20180615_1317'), 12 | ] 13 | 14 | operations = [ 15 | migrations.CreateModel( 16 | name='PriceHistory', 17 | fields=[ 18 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 19 | ('source', models.SmallIntegerField(choices=[(0, 'poloniex'), (1, 'bittrex'), (2, 'binance'), (3, 'bitfinex'), (4, 'kucoin'), (5, 'gdax'), (6, 'hitbtc')])), 20 | ('transaction_currency', models.CharField(max_length=6)), 21 | ('counter_currency', models.SmallIntegerField(choices=[(0, 'BTC'), (1, 'ETH'), (2, 'USDT'), (3, 'XMR')])), 22 | ('open_p', models.BigIntegerField(null=True)), 23 | ('high', models.BigIntegerField(null=True)), 24 | ('low', models.BigIntegerField(null=True)), 25 | ('close', models.BigIntegerField(null=True)), 26 | ('timestamp', models.DateTimeField()), 27 | ], 28 | ), 29 | ] 30 | -------------------------------------------------------------------------------- /apps/indicator/migrations/0022_pricehistory_volume.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-06-22 08:54 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('indicator', '0021_pricehistory'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='pricehistory', 17 | name='volume', 18 | field=models.FloatField(null=True), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /apps/indicator/migrations/0023_add_volume_to_price_resampl.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-06-28 07:54 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('indicator', '0022_pricehistory_volume'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='priceresampl', 17 | name='close_volume', 18 | field=models.FloatField(null=True), 19 | ), 20 | migrations.AddField( 21 | model_name='priceresampl', 22 | name='high_volume', 23 | field=models.FloatField(null=True), 24 | ), 25 | migrations.AddField( 26 | model_name='priceresampl', 27 | name='low_volume', 28 | field=models.FloatField(null=True), 29 | ), 30 | migrations.AddField( 31 | model_name='priceresampl', 32 | name='open_volume', 33 | field=models.FloatField(null=True), 34 | ), 35 | ] 36 | -------------------------------------------------------------------------------- /apps/indicator/migrations/0024_add_index_to_pricehistory.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-06-28 17:37 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('indicator', '0023_add_volume_to_price_resampl'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddIndex( 16 | model_name='pricehistory', 17 | index=models.Index(fields=['timestamp', 'transaction_currency', 'counter_currency', 'source'], name='indicator_p_timesta_c7c89a_idx'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /apps/indicator/migrations/0025_add_unique_together_to_pricehistory.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-07-18 09:51 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('indicator', '0024_add_index_to_pricehistory'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterUniqueTogether( 16 | name='pricehistory', 17 | unique_together=set([('timestamp', 'transaction_currency', 'counter_currency', 'source')]), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /apps/indicator/migrations/0026_annpriceclassification_ai_model.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-10-06 18:17 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('indicator', '0025_add_unique_together_to_pricehistory'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='annpriceclassification', 17 | name='ai_model', 18 | field=models.CharField(blank=True, max_length=16, null=True), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /apps/indicator/migrations/0027_priceresampl_volume_variance.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-10-07 17:05 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('indicator', '0026_annpriceclassification_ai_model'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='priceresampl', 17 | name='volume_variance', 18 | field=models.FloatField(null=True), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /apps/indicator/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/indicator/migrations/__init__.py -------------------------------------------------------------------------------- /apps/indicator/models/__init__.py: -------------------------------------------------------------------------------- 1 | from apps.indicator.models.price import Price 2 | from apps.indicator.models.volume import Volume 3 | from apps.indicator.models.sma import Sma 4 | from apps.indicator.models.rsi import Rsi 5 | from apps.indicator.models.events_elementary import EventsElementary 6 | from apps.indicator.models.events_logical import EventsLogical 7 | from apps.indicator.models.price_resampl import PriceResampl 8 | from apps.indicator.models.ann_future_price_classification import AnnPriceClassification 9 | from apps.indicator.models.price_history import PriceHistory 10 | 11 | 12 | __all__ = [ 13 | 'Price', 14 | 'Volume', 15 | 'PriceResampl', 16 | 'Sma', 17 | 'Rsi', 18 | 'AnnPriceClassification', 19 | 'EventsElementary', 20 | 'EventsLogical', 21 | 'PriceHistory', 22 | ] 23 | -------------------------------------------------------------------------------- /apps/indicator/models/abstract_indicator.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from unixtimestampfield.fields import UnixTimeStampField 3 | 4 | #from apps.channel.models.exchange_data import SOURCE_CHOICES 5 | #from apps.indicator.models.price import Price 6 | from settings import PERIODS_LIST, SOURCE_CHOICES, COUNTER_CURRENCY_CHOICES, BTC 7 | 8 | 9 | class AbstractIndicator(models.Model): 10 | source = models.SmallIntegerField(choices=SOURCE_CHOICES, null=False) 11 | counter_currency = models.SmallIntegerField(choices=COUNTER_CURRENCY_CHOICES, null=False, default=BTC) 12 | transaction_currency = models.CharField(max_length=6, null=False, blank=False) 13 | timestamp = UnixTimeStampField(null=False) 14 | resample_period = models.PositiveSmallIntegerField(null=False, default=PERIODS_LIST[0]) # minutes (eg. 15) 15 | 16 | # MODEL PROPERTIES 17 | 18 | # MODEL FUNCTIONS 19 | 20 | class Meta: 21 | abstract = True 22 | -------------------------------------------------------------------------------- /apps/indicator/models/events_probabilistic.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/indicator/models/events_probabilistic.py -------------------------------------------------------------------------------- /apps/info_bot/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/info_bot/__init__.py -------------------------------------------------------------------------------- /apps/info_bot/management/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/info_bot/management/__init__.py -------------------------------------------------------------------------------- /apps/info_bot/management/commands/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/info_bot/management/commands/__init__.py -------------------------------------------------------------------------------- /apps/info_bot/management/commands/run_info_bot.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import schedule 3 | import time 4 | import threading 5 | 6 | from django.core.management.base import BaseCommand 7 | 8 | from apps.info_bot.telegram.start_info_bot import start_info_bot 9 | 10 | 11 | 12 | logger = logging.getLogger(__name__) 13 | 14 | # Set via @BotFather: 15 | # can be added to groups, has access to all messages 16 | # 17 | # https://core.telegram.org/bots/faq#what-messages-will-my-bot-get 18 | 19 | class Command(BaseCommand): 20 | help = 'Run basic telegram info bot' 21 | 22 | def handle(self, *args, **options): 23 | logger.info("Starting telegram info_bot.") 24 | 25 | start_info_bot() -------------------------------------------------------------------------------- /apps/info_bot/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-05-24 13:37 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import unixtimestampfield.fields 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | initial = True 12 | 13 | dependencies = [ 14 | ] 15 | 16 | operations = [ 17 | migrations.CreateModel( 18 | name='InfoBotHistory', 19 | fields=[ 20 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 21 | ('update_id', models.IntegerField(null=True)), 22 | ('group_chat_id', models.IntegerField(null=True)), 23 | ('user_chat_id', models.IntegerField(null=True)), 24 | ('username', models.CharField(default='', max_length=32)), 25 | ('bot_command_text', models.CharField(default='', max_length=64)), 26 | ('language_code', models.CharField(default='', max_length=8)), 27 | ('datetime', unixtimestampfield.fields.UnixTimeStampField()), 28 | ], 29 | ), 30 | ] 31 | -------------------------------------------------------------------------------- /apps/info_bot/migrations/0002_infobothistory_chat_title.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-05-24 15:24 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('info_bot', '0001_initial'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='infobothistory', 17 | name='chat_title', 18 | field=models.CharField(default='', max_length=256), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /apps/info_bot/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/info_bot/migrations/__init__.py -------------------------------------------------------------------------------- /apps/info_bot/models/__init__.py: -------------------------------------------------------------------------------- 1 | from apps.info_bot.models.info_bot_history import InfoBotHistory 2 | -------------------------------------------------------------------------------- /apps/info_bot/models/info_bot_history.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from unixtimestampfield.fields import UnixTimeStampField 3 | 4 | 5 | 6 | class InfoBotHistory(models.Model): 7 | """ Log replies from the Telegram """ 8 | update_id = models.IntegerField(null=True) 9 | group_chat_id = models.IntegerField(null=True) 10 | user_chat_id = models.IntegerField(null=True) 11 | chat_title = models.CharField(max_length=256, default="") 12 | username = models.CharField(max_length=32, default="") 13 | bot_command_text = models.CharField(max_length=64, default="") 14 | language_code = models.CharField(max_length=8, default="") 15 | datetime = UnixTimeStampField(null=False) 16 | -------------------------------------------------------------------------------- /apps/info_bot/telegram/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/info_bot/telegram/__init__.py -------------------------------------------------------------------------------- /apps/info_bot/telegram/bot_commands/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/info_bot/telegram/bot_commands/__init__.py -------------------------------------------------------------------------------- /apps/info_bot/telegram/bot_commands/info.py: -------------------------------------------------------------------------------- 1 | """ Commands: 2 | 3 | info - list of supported coins, trading pairs and exchanges 4 | """ 5 | 6 | from telegram import ParseMode 7 | 8 | from taskapp.helpers import get_exchanges, get_source_name 9 | from apps.info_bot.helpers import get_currency_pairs, save_history 10 | 11 | from settings import LOCAL 12 | 13 | 14 | 15 | def info_view(update): 16 | 17 | view = f'Hello, {update.message.from_user.first_name}!\n\n' 18 | 19 | exchanges = (get_source_name(index).capitalize() for index in get_exchanges()) 20 | view += f'I support these exchanges: `{", ".join(exchanges)}\n\n`' 21 | 22 | period_in_seconds = 2*60*60 if not LOCAL else 2000*60*60 23 | trading_pairs = get_currency_pairs(source='all', period_in_seconds=period_in_seconds, counter_currency_format="text") 24 | 25 | coins = set(coin for coin, _ in trading_pairs) 26 | 27 | view += f'And {len(coins)} coins:\n`{", ".join(sorted(coins))}`\n\n' 28 | 29 | view += f'And {len(trading_pairs)} trading pairs, like `BTC_USDT, ETH_BTC, XRP_ETH ...`' 30 | 31 | return view 32 | 33 | # User Commands 34 | def info(bot, update): 35 | save_history(update) 36 | update.message.reply_text(info_view(update), ParseMode.MARKDOWN) 37 | return 38 | -------------------------------------------------------------------------------- /apps/info_bot/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/info_bot/tests/__init__.py -------------------------------------------------------------------------------- /apps/sentiment/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/sentiment/__init__.py -------------------------------------------------------------------------------- /apps/sentiment/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-11-07 12:41 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import unixtimestampfield.fields 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | initial = True 12 | 13 | dependencies = [ 14 | ] 15 | 16 | operations = [ 17 | migrations.CreateModel( 18 | name='Sentiment', 19 | fields=[ 20 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 21 | ('sentiment_source', models.SmallIntegerField(choices=[(0, 'reddit'), (1, 'bitcointalk'), (2, 'twitter')])), 22 | ('topic', models.CharField(max_length=6)), 23 | ('model', models.SmallIntegerField(choices=[(0, 'vader'), (1, 'nn_sentiment')])), 24 | ('positive', models.FloatField()), 25 | ('negative', models.FloatField()), 26 | ('neutral', models.FloatField(null=True)), 27 | ('compound', models.FloatField(null=True)), 28 | ('timestamp', unixtimestampfield.fields.UnixTimeStampField()), 29 | ('from_comments', models.BooleanField()), 30 | ], 31 | ), 32 | migrations.AddIndex( 33 | model_name='sentiment', 34 | index=models.Index(fields=['timestamp', 'model', 'sentiment_source', 'topic'], name='sentiment_s_timesta_787bb8_idx'), 35 | ), 36 | ] 37 | -------------------------------------------------------------------------------- /apps/sentiment/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/sentiment/migrations/__init__.py -------------------------------------------------------------------------------- /apps/sentiment/models/__init__.py: -------------------------------------------------------------------------------- 1 | from apps.sentiment.models.sentiment import Sentiment 2 | 3 | __all__ = [ 4 | 'Sentiment', 5 | ] 6 | -------------------------------------------------------------------------------- /apps/sentiment/static/itf-logo-gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/sentiment/static/itf-logo-gray.png -------------------------------------------------------------------------------- /apps/sentiment/static/itf-logo-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/sentiment/static/itf-logo-white.png -------------------------------------------------------------------------------- /apps/sentiment/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url 2 | from apps.sentiment.views.sentiment_dashboard import SentimentDashboard 3 | 4 | app_name = 'sentiment' 5 | 6 | urlpatterns = [ 7 | url(r'^$', SentimentDashboard.as_view(), name='sentiment'), 8 | url(r'^(?P[\w\-]+)/$', SentimentDashboard.as_view(), name='sentiment_timestamp'), 9 | 10 | ] 11 | -------------------------------------------------------------------------------- /apps/signal/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/signal/__init__.py -------------------------------------------------------------------------------- /apps/signal/management/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/signal/management/__init__.py -------------------------------------------------------------------------------- /apps/signal/migrations/0002_signal_timestamp.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2017-11-09 20:10 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | import django.utils.timezone 7 | import unixtimestampfield.fields 8 | 9 | 10 | class Migration(migrations.Migration): 11 | 12 | dependencies = [ 13 | ('signal', '0001_initial'), 14 | ] 15 | 16 | operations = [ 17 | migrations.AddField( 18 | model_name='signal', 19 | name='timestamp', 20 | field=unixtimestampfield.fields.UnixTimeStampField(default=django.utils.timezone.now), 21 | preserve_default=False, 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /apps/signal/migrations/0003_auto_20171113_2003.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2017-11-13 20:03 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | import unixtimestampfield.fields 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('signal', '0002_signal_timestamp'), 13 | ] 14 | 15 | operations = [ 16 | migrations.AlterField( 17 | model_name='signal', 18 | name='sent_at', 19 | field=unixtimestampfield.fields.UnixTimeStampField(default=None, null=True), 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /apps/signal/migrations/0004_auto_20171115_0627.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2017-11-15 06:27 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | import unixtimestampfield.fields 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('signal', '0003_auto_20171113_2003'), 13 | ] 14 | 15 | operations = [ 16 | migrations.AlterField( 17 | model_name='signal', 18 | name='sent_at', 19 | field=unixtimestampfield.fields.UnixTimeStampField(default=0), 20 | preserve_default=False, 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /apps/signal/migrations/0005_signal_rsi_value.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2017-11-25 17:32 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('signal', '0004_auto_20171115_0627'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='signal', 17 | name='rsi_value', 18 | field=models.FloatField(null=True), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /apps/signal/migrations/0006_auto_20171206_1053.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2017-12-06 10:53 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('signal', '0005_signal_rsi_value'), 13 | ] 14 | 15 | operations = [ 16 | migrations.RenameField( 17 | model_name='signal', 18 | old_name='price_satoshis', 19 | new_name='price', 20 | ), 21 | migrations.RenameField( 22 | model_name='signal', 23 | old_name='price_satoshis_change', 24 | new_name='price_change', 25 | ), 26 | migrations.RemoveField( 27 | model_name='signal', 28 | name='price_usdt', 29 | ), 30 | migrations.RemoveField( 31 | model_name='signal', 32 | name='price_usdt_change', 33 | ), 34 | migrations.AddField( 35 | model_name='signal', 36 | name='base_coin', 37 | field=models.SmallIntegerField(choices=[(0, 'BTC'), (1, 'ETH'), (2, 'USDT'), (3, 'XMR')], default=0), 38 | ), 39 | 40 | 41 | ] 42 | -------------------------------------------------------------------------------- /apps/signal/migrations/0007_auto_20171212_0252.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2017-12-12 02:52 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('signal', '0006_auto_20171206_1053'), 12 | ] 13 | 14 | operations = [ 15 | migrations.RenameField( 16 | model_name='signal', 17 | old_name='base_coin', 18 | new_name='counter_currency', 19 | ), 20 | migrations.RenameField( 21 | model_name='signal', 22 | old_name='coin', 23 | new_name='transaction_currency', 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /apps/signal/migrations/0008_signal_resample_period.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-01-29 15:40 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('signal', '0007_auto_20171212_0252'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='signal', 17 | name='resample_period', 18 | field=models.PositiveSmallIntegerField(default=60), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /apps/signal/migrations/0009_auto_20180406_1217.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-04-06 12:17 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('signal', '0008_signal_resample_period'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='signal', 17 | name='predicted_ahead_for', 18 | field=models.SmallIntegerField(null=True), 19 | ), 20 | migrations.AddField( 21 | model_name='signal', 22 | name='probability_down', 23 | field=models.FloatField(null=True), 24 | ), 25 | migrations.AddField( 26 | model_name='signal', 27 | name='probability_same', 28 | field=models.FloatField(null=True), 29 | ), 30 | migrations.AddField( 31 | model_name='signal', 32 | name='probability_up', 33 | field=models.FloatField(null=True), 34 | ), 35 | ] 36 | -------------------------------------------------------------------------------- /apps/signal/migrations/0010_add_more_sources.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-04-17 15:02 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('signal', '0009_auto_20180406_1217'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='signal', 17 | name='source', 18 | field=models.SmallIntegerField(choices=[(0, 'poloniex'), (1, 'bittrex'), (2, 'binance'), (3, 'bitfinex'), (4, 'kucoin'), (5, 'gdax'), (6, 'hitbtc')], default=0), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /apps/signal/migrations/0011_auto_20180604_1126.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-06-04 11:26 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('signal', '0010_add_more_sources'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddIndex( 16 | model_name='signal', 17 | index=models.Index(fields=['source', 'resample_period', 'counter_currency', 'transaction_currency'], name='signal_sign_source_da8a8b_idx'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /apps/signal/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/signal/migrations/__init__.py -------------------------------------------------------------------------------- /apps/signal/models/__init__.py: -------------------------------------------------------------------------------- 1 | from apps.signal.models.signal import Signal 2 | 3 | __all__ = [ 4 | "Signal", 5 | ] 6 | -------------------------------------------------------------------------------- /apps/strategy/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/strategy/__init__.py -------------------------------------------------------------------------------- /apps/strategy/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-04-12 12:20 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | initial = True 11 | 12 | dependencies = [ 13 | ] 14 | 15 | operations = [ 16 | migrations.CreateModel( 17 | name='Strategy', 18 | fields=[ 19 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 20 | ('name', models.CharField(max_length=32)), 21 | ('generated', models.CharField(max_length=16)), 22 | ('last_backtested_performance', models.FloatField(null=True)), 23 | ('implementation_class_name', models.CharField(max_length=64, null=True)), 24 | ], 25 | ), 26 | ] 27 | -------------------------------------------------------------------------------- /apps/strategy/migrations/0002_auto_20180416_1542.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-04-16 15:42 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('backtesting', '0002_auto_20180416_1542'), 12 | ('strategy', '0001_initial'), 13 | ] 14 | 15 | operations = [ 16 | migrations.CreateModel( 17 | name='StrategyRef', 18 | fields=[ 19 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 20 | ('name', models.CharField(max_length=64)), 21 | ('implementation_class_name', models.CharField(max_length=64, null=True)), 22 | ('description', models.TextField(null=True)), 23 | ('generated', models.CharField(max_length=16)), 24 | ('last_backtested_performance', models.FloatField(null=True)), 25 | ], 26 | ), 27 | migrations.DeleteModel( 28 | name='Strategy', 29 | ), 30 | ] 31 | -------------------------------------------------------------------------------- /apps/strategy/migrations/0003_strategyref_implementation_module_name.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-04-18 13:04 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('strategy', '0002_auto_20180416_1542'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='strategyref', 17 | name='implementation_module_name', 18 | field=models.CharField(max_length=128, null=True), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /apps/strategy/migrations/0004_delete_strategyref.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2018-05-24 17:16 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('strategy', '0003_strategyref_implementation_module_name'), 12 | ] 13 | 14 | operations = [ 15 | migrations.DeleteModel( 16 | name='StrategyRef', 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /apps/strategy/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/strategy/migrations/__init__.py -------------------------------------------------------------------------------- /apps/strategy/models/__init__.py: -------------------------------------------------------------------------------- 1 | # from apps.strategy.models.strategy_ref import StrategyRef 2 | # 3 | # __all__ = [ 4 | # StrategyRef, 5 | # ] -------------------------------------------------------------------------------- /apps/strategy/models/ai_strategies.py: -------------------------------------------------------------------------------- 1 | from apps.strategy.models.abstract_strategy import AbstractStrategy 2 | import logging 3 | 4 | logger = logging.getLogger(__name__) 5 | 6 | 7 | class AnnSimpleStrategy(AbstractStrategy): 8 | strategy_signals_set = set(['ann_simple_bull', 'ann_simple_bear']) 9 | 10 | def __str__(self): 11 | return "AiSimpleStrategy" 12 | 13 | # TODO: make sure that signals go in order, i.e. buy/sell/buy/sell/... 14 | # by retrieving the previous signal in strategy 15 | 16 | -------------------------------------------------------------------------------- /apps/strategy/models/baseline_strategies.py: -------------------------------------------------------------------------------- 1 | from apps.strategy.models.abstract_strategy import AbstractStrategy 2 | 3 | class RandomStrategy(AbstractStrategy): 4 | pass 5 | 6 | class BuyAndHoldStrategy(AbstractStrategy): 7 | pass 8 | 9 | -------------------------------------------------------------------------------- /apps/strategy/models/ichi_strategies.py: -------------------------------------------------------------------------------- 1 | from apps.strategy.models.abstract_strategy import AbstractStrategy 2 | from apps.signal.models.signal import get_all_signals_names_now, get_signals_ts 3 | import logging 4 | logger = logging.getLogger(__name__) 5 | 6 | 7 | 8 | class IchiKumoBreakoutStrategy(AbstractStrategy): 9 | strategy_signals_set = set(['ichi_kumo_up', 'ichi_kumo_down']) 10 | 11 | def __str__(self): 12 | return "IchiKumoBreakoutStrategy" 13 | 14 | #TODO: make sure that signals go in order, i.e. buy/sell/buy/sell/... 15 | # by retrieving the previous signal in strategy 16 | 17 | -------------------------------------------------------------------------------- /apps/strategy/models/multi_currency_strategies.py: -------------------------------------------------------------------------------- 1 | from apps.strategy.models.abstract_strategy import AbstractStrategy 2 | 3 | class MultyCurrencyStrategy(AbstractStrategy): 4 | # TODO: in case of multicurrency strategy, add additional currencies 5 | # and overload constructor with one more parameter 6 | 7 | additional_currency_pairs = None # should be [ (BTC,2), (ETH,0) ... ] 8 | 9 | # a difference with one-currency strategy is that in addition to main (coin,currency) 10 | # we also a have a list of additional currencies which we can buy in/out 11 | def __init__(self, parameters, additional_currency_pairs): 12 | super(MultyCurrencyStrategy, self).__init__(parameters) 13 | self.additional_currency_pairs = additional_currency_pairs -------------------------------------------------------------------------------- /apps/strategy/models/rsi_sma_strategies.py: -------------------------------------------------------------------------------- 1 | from apps.strategy.models.abstract_strategy import AbstractStrategy 2 | 3 | import logging 4 | logger = logging.getLogger(__name__) 5 | 6 | ################ Pattern for other strategies ################# 7 | class RsiSimpleStrategy(AbstractStrategy): 8 | ''' 9 | select a subset of already generated signals from the Signal class 10 | that subset shall represent a given strategy, for example for RsiSimple as follows: 11 | - RSI simple strategy is buy when RSI < 25 and sell when RSI > 85 12 | ''' 13 | 14 | # list of signals belonging to this strategy 15 | # NOTE: check signals.ALL_SIGNALS namedtuple 16 | strategy_signals_set = set(['rsi_sell_3', 'rsi_buy_3']) 17 | 18 | def __str__(self): 19 | return "RsiSimpleStrategy" 20 | 21 | 22 | #################################### 23 | 24 | 25 | 26 | class SmaCrossOverStrategy(AbstractStrategy): 27 | strategy_signals_set = set() # add here 28 | 29 | def check_signal_now(self): 30 | pass 31 | 32 | 33 | def get_all_signals_in_time_period(self, start_timestamp, end_timestamp): 34 | pass 35 | 36 | 37 | 38 | class RsiSmaMixedStrategy(AbstractStrategy): 39 | def check_signal_now(self): 40 | pass 41 | 42 | def get_all_signals_in_time_period(self, start_timestamp, end_timestamp): 43 | pass -------------------------------------------------------------------------------- /apps/strategy/models/volume_based_strategies.py: -------------------------------------------------------------------------------- 1 | from apps.strategy.models.abstract_strategy import AbstractStrategy 2 | 3 | import logging 4 | logger = logging.getLogger(__name__) 5 | 6 | ################ Pattern for other strategies ################# 7 | class VolumeBasedStrategy(AbstractStrategy): 8 | ''' 9 | select a subset of already generated signals from the Signal class 10 | that subset shall represent a given strategy, for example for RsiSimple as follows: 11 | - RSI simple strategy is buy when RSI < 25 and sell when RSI > 85 12 | ''' 13 | 14 | # list of signals belonging to this strategy 15 | # NOTE: check signals.ALL_SIGNALS namedtuple 16 | strategy_signals_set = set(['rsi_sell_3', 'vbi_buy']) 17 | 18 | def __str__(self): 19 | return "VolumeBasedStrategy" -------------------------------------------------------------------------------- /apps/user/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/user/__init__.py -------------------------------------------------------------------------------- /apps/user/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from apps.user import models 3 | 4 | class BaseAdmin(admin.ModelAdmin): 5 | exclude = ('created_at', 'modified_at',) 6 | 7 | 8 | admin.site.register(models.User) 9 | -------------------------------------------------------------------------------- /apps/user/fixtures/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/user/fixtures/__init__.py -------------------------------------------------------------------------------- /apps/user/forms/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/user/forms/__init__.py -------------------------------------------------------------------------------- /apps/user/migrations/0002_auto_20171018_1131.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2017-10-18 11:31 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('user', '0001_initial'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='user', 17 | name='is_muted', 18 | field=models.BooleanField(default=False), 19 | ), 20 | migrations.AddField( 21 | model_name='user', 22 | name='is_subscribed', 23 | field=models.BooleanField(default=False), 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /apps/user/migrations/0003_auto_20171019_1503.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2017-10-19 15:03 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('user', '0002_auto_20171018_1131'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='user', 17 | name='horizon', 18 | field=models.SmallIntegerField(choices=[(0, 'short'), (1, 'medium'), (2, 'long')], default=1), 19 | ), 20 | migrations.AddField( 21 | model_name='user', 22 | name='risk', 23 | field=models.SmallIntegerField(choices=[(0, 'low'), (1, 'medium'), (2, 'high')], default=0), 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /apps/user/migrations/0004_auto_20171115_0824.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2017-11-15 08:24 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('user', '0003_auto_20171019_1503'), 12 | ] 13 | 14 | operations = [ 15 | migrations.RemoveField( 16 | model_name='user', 17 | name='is_subscribed', 18 | ), 19 | migrations.AddField( 20 | model_name='user', 21 | name='beta_subscription_token', 22 | field=models.CharField(max_length=8, null=True, unique=True), 23 | ), 24 | migrations.AddField( 25 | model_name='user', 26 | name='subscribed_since', 27 | field=models.DateTimeField(null=True), 28 | ), 29 | ] 30 | -------------------------------------------------------------------------------- /apps/user/migrations/0005_auto_20171115_0828.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2017-11-15 08:28 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('user', '0004_auto_20171115_0824'), 12 | ] 13 | 14 | operations = [ 15 | migrations.RenameField( 16 | model_name='user', 17 | old_name='beta_subscription_token', 18 | new_name='_beta_subscription_token', 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /apps/user/migrations/0006_auto_20171116_0609.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2017-11-16 06:09 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('user', '0005_auto_20171115_0828'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='user', 17 | name='_beta_subscription_token', 18 | field=models.CharField(default='', max_length=8), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /apps/user/migrations/0007_user_is_itt_team.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.11 on 2017-11-16 20:10 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('user', '0006_auto_20171116_0609'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='user', 17 | name='is_ITT_team', 18 | field=models.BooleanField(default=False), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /apps/user/migrations/0008_auto_20181018_2026.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.1.2 on 2018-10-18 20:26 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('user', '0007_user_is_itt_team'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='user', 15 | name='last_name', 16 | field=models.CharField(blank=True, max_length=150, verbose_name='last name'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /apps/user/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/user/migrations/__init__.py -------------------------------------------------------------------------------- /apps/user/models/__init__.py: -------------------------------------------------------------------------------- 1 | from apps.user.models.user import User 2 | 3 | __all__ = [ 4 | User, 5 | ] 6 | -------------------------------------------------------------------------------- /apps/user/templates/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/user/templates/__init__.py -------------------------------------------------------------------------------- /apps/user/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url, include 2 | 3 | urlpatterns = [ 4 | 5 | ] 6 | -------------------------------------------------------------------------------- /apps/user/views/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/apps/user/views/__init__.py -------------------------------------------------------------------------------- /docs/TEMP.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/docs/TEMP.md -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError: 10 | # The above import may fail for some other reason. Ensure that the 11 | # issue is really that Django is missing to avoid masking other 12 | # exceptions on Python 2. 13 | try: 14 | import django 15 | except ImportError: 16 | raise ImportError( 17 | "Couldn't import Django. Are you sure it's installed and " 18 | "available on your PYTHONPATH environment variable? Did you " 19 | "forget to activate a virtual environment?" 20 | ) 21 | raise 22 | execute_from_command_line(sys.argv) 23 | -------------------------------------------------------------------------------- /nltk.txt: -------------------------------------------------------------------------------- 1 | vader_lexicon -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | architect==0.5.6 2 | boto==2.45.0 3 | boto3==1.7.22 4 | celery==4.1.1 5 | celery-redbeat==0.11.1 6 | ccxt==1.13.38 7 | decorator==4.0.10 8 | dj-database-url==0.4.1 9 | dj-static==0.0.6 10 | Django==2.2.24 11 | django-bmemcached==0.2.3 12 | django-cache-memoize==0.1.1 13 | django-cors-headers==2.3.0 14 | django-debug-toolbar==1.11.1 15 | django-extensions==1.7.5 16 | django-filter==2.0.0 17 | django-rest-swagger==2.1.2 18 | django-storages==1.5.1 19 | django-toolbelt==0.0.1 20 | django-unixtimestampfield==0.3.9 21 | djangorestframework==3.11.2 22 | ipython==5.1.0 23 | jsonfield==1.0.3 24 | numpy==1.14.4 25 | pandas==0.23.4 26 | pika==0.12.0 27 | python-binary-memcached==0.26.1 28 | python-dateutil==2.6.0 29 | python-memcached==1.59 30 | python-telegram-bot==10.1.0 31 | psycopg2-binary==2.7.6.1 32 | pytz==2016.10 33 | PyYAML>=4.2b1 34 | redis==2.10.6 35 | requests-oauthlib==0.8.0 36 | requests==2.20.0 37 | schedule==0.4.3 38 | simplejson==3.11.1 39 | six==1.11.0 40 | TA-Lib==0.4.17 41 | toolz==0.9.0 42 | twython==3.7.0 43 | urllib3>=1.23 44 | waitress==1.4.3 45 | whitenoise==3.3.1 46 | 47 | tensorflow 48 | keras 49 | h5py 50 | scipy 51 | nltk 52 | tweepy 53 | bs4 54 | praw 55 | sklearn 56 | -------------------------------------------------------------------------------- /runtime.txt: -------------------------------------------------------------------------------- 1 | python-3.6.4 2 | -------------------------------------------------------------------------------- /settings/local_settings_template.py: -------------------------------------------------------------------------------- 1 | SECRET_KEY = '' 2 | 3 | # https://docs.djangoproject.com/en/1.7/ref/settings/#databases 4 | DATABASES = { 5 | 'default': { 6 | 'ENGINE': 'django.db.backends.postgresql_psycopg2', 7 | 'NAME': '', 8 | 'USER': '', 9 | 'PASSWORD': '', 10 | 'HOST': 'localhost', 11 | 'PORT': '5432', 12 | } 13 | } 14 | 15 | 16 | DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' 17 | 18 | AWS_OPTIONS = { 19 | 'AWS_ACCESS_KEY_ID' : '', 20 | 'AWS_SECRET_ACCESS_KEY' : '', 21 | 'AWS_STORAGE_BUCKET_NAME' : 'itt-stage', 22 | } 23 | 24 | 25 | #MEMCACHED CLOUD RESPONSE CACHEING 26 | #no cacheing on local dev 27 | CACHES = { 28 | 'default': { 29 | 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 30 | 'LOCATION': '127.0.0.1:11211', 31 | } 32 | } 33 | 34 | # Disable auth for REST API 35 | REST_FRAMEWORK = { 36 | 'DEFAULT_AUTHENTICATION_CLASSES': (), 37 | 'DEFAULT_PERMISSION_CLASSES': (), 38 | 'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',), 39 | } -------------------------------------------------------------------------------- /settings/redis_db.py: -------------------------------------------------------------------------------- 1 | import os 2 | import logging 3 | import redis 4 | from apps.TA import deployment_type 5 | from settings import DEBUG 6 | 7 | SIMULATED_ENV = deployment_type == "LOCAL" 8 | # todo: use this to mark keys in redis db, so they can be separated and deleted 9 | 10 | logger = logging.getLogger('redis_db') 11 | 12 | if deployment_type == "LOCAL": 13 | from settings.local_settings import TA_REDIS_URL 14 | if TA_REDIS_URL: 15 | database = redis.from_url(TA_REDIS_URL) 16 | else: 17 | REDIS_HOST, REDIS_PORT = "127.0.0.1:6379".split(":") 18 | pool = redis.ConnectionPool(host=REDIS_HOST, port=REDIS_PORT, db=0) 19 | database = redis.Redis(connection_pool=pool) 20 | else: 21 | database = redis.from_url(os.environ.get("TA_REDIS_URL")) 22 | 23 | if DEBUG: 24 | logger.info("Redis connection established for app database.") 25 | used_memory, maxmemory = int(database.info()['used_memory']), int(database.info()['maxmemory']) 26 | maxmemory_human = database.info()['maxmemory_human'] 27 | logger.info(f"Redis currently consumes {round(100*used_memory/maxmemory if maxmemory != 0 else 0, 2)}% out of {maxmemory_human}") 28 | 29 | -------------------------------------------------------------------------------- /settings/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import include, url 2 | from django.contrib import admin 3 | 4 | 5 | urlpatterns = [ 6 | 7 | # url(r'^$', Home.as_view(), name='home'), 8 | 9 | url(r'^api/v3/', include('apps.TA.urls', namespace='redis_api')), 10 | url(r'^api/', include('apps.api.urls', namespace='api')), 11 | url(r'^dashboard/', include('apps.dashboard.urls', namespace='dashboard')), 12 | url(r'^sentiment/', include('apps.sentiment.urls', namespace='sentiment')), 13 | 14 | # url(r'^admin/', admin.site.urls), 15 | 16 | ] 17 | -------------------------------------------------------------------------------- /settings/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for ITT project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /static/css/base.css: -------------------------------------------------------------------------------- 1 | 2 | img{min-height: 0px;} 3 | -------------------------------------------------------------------------------- /static/javascript/base.js: -------------------------------------------------------------------------------- 1 | 2 | //highlight action if targeted in url 3 | $(document).ready(function(){ 4 | $(".search-hit:target").find(".taken-actions").css("background", "lightyellow") 5 | }) 6 | 7 | //default popover and tooltip activators 8 | $(function () { 9 | $('[data-toggle="popover"]').popover() 10 | }); 11 | $(function () { 12 | $('[data-toggle="tooltip"]').tooltip() 13 | }); 14 | 15 | //custom popover activator 16 | $('[popover-content]').each(function(){ 17 | $(this).popover({ 18 | placement: 'top', 19 | html : ($(this).attr("popover-html") == "true"), 20 | title : $(this).attr("popover-title"), 21 | content : $(this).attr("popover-content") 22 | }) 23 | }); 24 | 25 | //custom tooltip activator 26 | $('[tooltip-title]').each(function(){ 27 | $(this).tooltip({ 28 | placement : 'bottom', 29 | title : $(this).attr("tooltip-title") 30 | }) 31 | }); 32 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/LICENSE: -------------------------------------------------------------------------------- 1 | Bootstrap Multiple Use License 2 | 3 | + Your use of the theme can extend to multiple installations. 4 | + You can use the theme in work which you are creating for your own purposes or for clients. 5 | + You cannot incorporate the theme in a work created for redistribution or resale by you or your clients. 6 | + You cannot redistribute or resell the theme or source files. 7 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/assets/css/application.css: -------------------------------------------------------------------------------- 1 | /* global body padding */ 2 | body { 3 | padding-top: 20px; 4 | padding-bottom: 20px; 5 | } 6 | 7 | @media (min-width: 768px) { 8 | body { 9 | padding-top: 50px; 10 | padding-bottom: 50px; 11 | } 12 | } 13 | 14 | 15 | /* global spacing overrides */ 16 | h1, h2, h3, h4, h5, h6, 17 | .h1, .h2, .h3, .h4, .h5, .h6 { 18 | margin-top: 0; 19 | } 20 | hr { 21 | margin-top: 30px; 22 | margin-bottom: 30px; 23 | } 24 | 25 | .navbar-fixed-top, 26 | .navbar-static-top { 27 | border-bottom: 0; 28 | } 29 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/assets/fonts/toolkit-entypo.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/static/vendor/bootstrap-theme/docs/assets/fonts/toolkit-entypo.eot -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/assets/fonts/toolkit-entypo.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/static/vendor/bootstrap-theme/docs/assets/fonts/toolkit-entypo.ttf -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/assets/fonts/toolkit-entypo.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/static/vendor/bootstrap-theme/docs/assets/fonts/toolkit-entypo.woff -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/assets/fonts/toolkit-entypo.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/static/vendor/bootstrap-theme/docs/assets/fonts/toolkit-entypo.woff2 -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/assets/img/avatar-mdo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/static/vendor/bootstrap-theme/docs/assets/img/avatar-mdo.png -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/component-avatar-list.md: -------------------------------------------------------------------------------- 1 | ## Avatar list 2 | 3 | Join a series of icons into a single horizontal grouping. 4 | 5 | {% example html %} 6 |
    7 |
  • 8 | 9 |
  • 10 |
  • 11 | 12 |
  • 13 |
  • 14 | 15 |
  • 16 |
17 | {% endexample %} 18 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/component-callouts.md: -------------------------------------------------------------------------------- 1 | ## Callouts 2 | 3 | Use callouts to quickly draw attention to specific actions with an extended explanation. 4 | 5 | {% example html %} 6 |
7 |
8 | Explore this thing. Learn more about this thing. 9 |
10 | 11 |
12 | 13 |
14 |
15 | {% endexample %} 16 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/component-checklist.md: -------------------------------------------------------------------------------- 1 | ## Checklist 2 | 3 | {% example html %} 4 |
    5 |
  • Single
  • 6 |
  • Taken
  • 7 |
  • Pokémon Master
  • 8 |
9 | {% endexample %} 10 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/component-container-custom.md: -------------------------------------------------------------------------------- 1 | ## Custom containers 2 | 3 | We've introduced a new component for vertically aligning content with `.container-content-middle` and `.container-content-bottom`. This is particularly useful for sign in and other simple pages. 4 | 5 | {% example html %} 6 |
7 |
8 | Vertically centered content. 9 |
10 |
11 | {% endexample %} 12 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/component-dashhead.md: -------------------------------------------------------------------------------- 1 | ## Dashhead 2 | 3 | The dashhead is a custom component built to house all the textual headings, form controls, buttons, and more that are common for the top of dashboard page. 4 | 5 | {% example html %} 6 |
7 |
8 |
Dashboards
9 |

Overview

10 |
11 | 12 |
13 |
14 | 15 | 16 |
17 | 18 |
19 | 20 | 21 | 22 |
23 |
24 |
25 | {% endexample %} 26 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/component-divided-heading.md: -------------------------------------------------------------------------------- 1 | ## Divided heading 2 | 3 | Use a divided heading to call special attention to a separation of content in your pages. 4 | 5 | {% example html %} 6 |
7 |

8 | Divider heading 9 |

10 |
11 | {% endexample %} 12 | 13 | You can also use it with pill navigation: 14 | 15 | {% example html %} 16 |
17 | 28 |
29 | {% endexample %} 30 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/component-flextable.md: -------------------------------------------------------------------------------- 1 | ## Flex table 2 | 3 | Use the flex table classes when you need to keep related elements on the same row, but with flexible individual widths. 4 | 5 | {% example html %} 6 |
7 |
8 | 9 |
10 |
11 |
12 | 15 | 18 |
19 |
20 |
21 | {% endexample %} 22 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/component-growl.md: -------------------------------------------------------------------------------- 1 | ## Growl 2 | 3 | Use the Growl plugin to turn any Bootstrap alert into an OS X style notification. Growls are fixed to the top right of your viewport and can be dismissed, just like normal Bootstrap alerts. 4 | 5 | {% example html %} 6 |
7 | 13 |
14 | {% endexample %} 15 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/component-icon-input.md: -------------------------------------------------------------------------------- 1 | ## Icon input 2 | 3 | Easily overlay an icon on an input. 4 | 5 | {% example html %} 6 |
7 | 8 | 9 |
10 | {% endexample %} 11 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/component-iconlist.md: -------------------------------------------------------------------------------- 1 | ## Icon list 2 | 3 | Use an icon list to place custom icons next to a list of items. 4 | 5 | {% example html %} 6 |
    7 |
  • 8 | 9 | Single 10 |
  • 11 |
  • 12 | 13 | Taken 14 |
  • 15 |
  • 16 | 17 | Pokémon Master 18 |
  • 19 |
20 | {% endexample %} 21 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/component-list-groups.md: -------------------------------------------------------------------------------- 1 | ## List group 2 | 3 | Bootstrap's default list group component is extended with a few additional features. 4 | 5 | ### List group header 6 | 7 | New to the theme is a header for list groups, similar to panels. use it for standalone lists as needed. This should not be used with panels. 8 | 9 | {% example html %} 10 |
    11 |
  • List group header
  • 12 |
  • Cras justo odio
  • 13 |
  • Dapibus ac facilisis in
  • 14 |
  • Morbi leo risus
  • 15 |
  • Porta ac consectetur ac
  • 16 |
  • Vestibulum at eros
  • 17 |
18 | {% endexample %} 19 | 20 | 21 | ### List group progress 22 | 23 | Similar to stat lists, add a background progress indicator to any list group item. 24 | 25 | {% example html %} 26 |
    27 |
  • 28 | Cras justo odio 29 | 30 |
  • 31 |
  • 32 | Porta ac consectetur ac 33 | 34 |
  • 35 |
  • 36 | Vestibulum at eros 37 | 38 |
  • 39 |
40 | {% endexample %} 41 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/component-nav-bordered.md: -------------------------------------------------------------------------------- 1 | ## Nav bordered 2 | 3 | The bordered nav builds on Bootstrap's `.nav` base styles with a new, bolder variation to nav links. 4 | 5 | {% example html %} 6 | 20 | {% endexample %} 21 | 22 | Bordered nav links can also be stacked: 23 | 24 | {% example html %} 25 | 46 | {% endexample %} 47 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/component-navbars-transparent.md: -------------------------------------------------------------------------------- 1 | ## Transparent navbar 2 | 3 | Use the new `.navbar-transparent` variation for placing navbars over backgrounds and interactive content. 4 | 5 | {% example html %} 6 |
7 | 8 | 38 | 39 |
40 | {% endexample %} 41 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/component-navs.md: -------------------------------------------------------------------------------- 1 | ## Navs 2 | 3 | {% example html %} 4 | 9 | {% endexample %} 10 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/component-panel-bold.md: -------------------------------------------------------------------------------- 1 | ## Panel bold 2 | 3 | Bold variants for Bootstrap's panel component, featuring vibrant solid color blocks. 4 | 5 | {% example html %} 6 |
7 |
8 |
9 |
10 |

Rhianna Loud

11 |

Released on Dropp 6 weeks early

12 |
13 |

Rihanna was the first artist to reach out to Dropp to coordinate her leak. We knew it was going to be the largest unofficial album drop in history. We doubled server capacity and made a shit ton of coffee.

14 |
15 |
16 |
17 |
18 |
19 |
20 |

Magna Carta

21 |

Released on Dropp 8 weeks early

22 |
23 |

It's the twelfth studio album by American rapper Jay Z. It was made available for free digital download for Samsung customers via the Jay Z Magna Carta app on July 4, 2013 and Dropp just 3 days later.

24 |
25 |
26 |
27 |
28 | {% endexample %} 29 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/component-panel-link-list.md: -------------------------------------------------------------------------------- 1 | ## Card link list 2 | 3 | Simple card modifier for link lists. 4 | 5 | {% example html %} 6 | 25 | {% endexample %} 26 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/component-profile-header.md: -------------------------------------------------------------------------------- 1 | ## Profile header 2 | 3 | Simple profile headers to show off a user's profile information 4 | 5 | 6 | {% example html %} 7 |
8 |
9 |
10 | 11 |

Dave Gamache

12 |

I wish i was a little bit taller, wish i was a baller, wish i had a girl… also.

13 |
14 |
15 | 28 |
29 | {% endexample %} 30 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/component-pull-quote.md: -------------------------------------------------------------------------------- 1 | ## Pull Quotes 2 | 3 | Transform normal blockquotes into stylized pull quotes. 4 | 5 | {% example html %} 6 |
7 | 8 |

9 | “They need to stop sleeping on me and get some understanding about this here game I spit!” 10 |

11 | Mark Otto, Huge Nerd 12 |
13 | {% endexample %} 14 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/plugin-chartjs.md: -------------------------------------------------------------------------------- 1 | ## Chart.js 2 | 3 | Charts and graphs are available through [Chart.js](http://www.chartjs.org), a clean and responsive canvas-based chart rendering JavaScript library. 4 | 5 | We recommend reviewing the full [Chart.js documentation](http://www.chartjs.org/docs/) as you implement or modify any charts here. 6 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/plugin-datepicker.md: -------------------------------------------------------------------------------- 1 | ## Datepicker 2 | 3 | We've integrated the excellent [Bootstrap Datepicker](https://bootstrap-datepicker.readthedocs.org/en/latest/) plugin for your convenience. You can initiate this simply with data-attributes or for more advanced applications use the javascript API. Refer to [their docs for more information](https://bootstrap-datepicker.readthedocs.org/en/latest/). 4 | 5 | {% example html %} 6 |
7 | 8 | 9 | 10 | 11 |
12 | {% endexample %} 13 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/plugin-enter.md: -------------------------------------------------------------------------------- 1 | ## Enter 2 | 3 | Enter is a brand new plugin built to transition elements into view on scroll and offer subtle visual flourishes. Simply add a `data-transition="entrance"` attribute and a `transform` style to any element that you'd like to *enter* in when a user scrolls the element into view. 4 | 5 | ### Options 6 | 7 | - easing: `cubic-bezier(.2,.7,.5,1)`, 8 | - duration: 1200, 9 | - delay: 0 10 | 11 | ### JavaScript API 12 | 13 | {% highlight js %} 14 | $('.js-enter').enter() 15 | {% endhighlight %} 16 | 17 | ### Data API 18 | 19 | {% example html %} 20 |
21 |
22 |

23 | Etiam porta sem malesuada magna mollis euismod. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. 24 |

25 |

26 | Donec sed odio dui. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Curabitur blandit tempus porttitor. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. 27 |

28 |
29 |
30 | {% endexample %} 31 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/plugin-image-grid.md: -------------------------------------------------------------------------------- 1 | ## Image grids 2 | 3 | Use the image grid plugin to quickly layout multi sized images in a grid. For the image grid to work properly, it needs to get the raw image sizes (either from a data attribute, like `data-width` and `data-height` or you need to wait for image load before calling `.imageGrid`). 4 | 5 | ### Options 6 | 7 | - padding: 10, 8 | - targetHeight: 300, 9 | - display: 'inline-block' 10 | 11 | ### JavaScript API 12 | {% example js %} 13 | $('.myGrid').imageGrid() 14 | {% endexample %} 15 | 16 | ### Data Api 17 | 18 | {% example html %} 19 |
20 | 21 | 22 | 23 | 24 | 25 |
26 | {% endexample %} 27 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/docs/components/plugin-zoom.md: -------------------------------------------------------------------------------- 1 | ## Zoom 2 | 3 | The zoom plugin provides simple image zoom functionality. Add a `data-action="zoom"` attribute to any image you want to make zoomable. Zoomed images can be closed by scroll, `esc`, or click. Use the meta key to open raw element in new tab. 4 | 5 | ### Data API 6 | 7 | {% example html %} 8 | 9 | {% endexample %} 10 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/fonts/toolkit-entypo.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/static/vendor/bootstrap-theme/fonts/toolkit-entypo.eot -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/fonts/toolkit-entypo.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/static/vendor/bootstrap-theme/fonts/toolkit-entypo.ttf -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/fonts/toolkit-entypo.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/static/vendor/bootstrap-theme/fonts/toolkit-entypo.woff -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/fonts/toolkit-entypo.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/static/vendor/bootstrap-theme/fonts/toolkit-entypo.woff2 -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "toolkit", 4 | "version": "1.0.0", 5 | "description": "A bootstrap toolkit.", 6 | "main": "gulpfile.js", 7 | "author": "Colossal", 8 | "scripts": { 9 | "start": "./node_modules/.bin/gulp docs" 10 | }, 11 | "devDependencies": { 12 | "babel-plugin-transform-es2015-modules-strip": "^0.1.0", 13 | "babel-preset-es2015": "^6.18.0", 14 | "gulp": "^3.9.1", 15 | "gulp-autoprefixer": "^3.1.1", 16 | "gulp-babel": "^6.1.2", 17 | "gulp-clean-css": "^2.3.2", 18 | "gulp-concat": "^2.6.1", 19 | "gulp-connect": "^5.0.0", 20 | "gulp-open": "^2.0.0", 21 | "gulp-rename": "^1.2.2", 22 | "gulp-replace": "^0.5.4", 23 | "gulp-sass": "^3.0.0", 24 | "gulp-sourcemaps": "^1.9.1", 25 | "gulp-uglify": "^1.2.0", 26 | "gulp-wrapper": "^1.0.0" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/_breadcrumb.scss: -------------------------------------------------------------------------------- 1 | .breadcrumb { 2 | padding: $breadcrumb-padding-y $breadcrumb-padding-x; 3 | margin-bottom: $spacer-y; 4 | list-style: none; 5 | background-color: $breadcrumb-bg; 6 | @include border-radius($border-radius); 7 | @include clearfix; 8 | } 9 | 10 | .breadcrumb-item { 11 | float: left; 12 | 13 | // The separator between breadcrumbs (by default, a forward-slash: "/") 14 | + .breadcrumb-item::before { 15 | display: inline-block; // Suppress underlining of the separator in modern browsers 16 | padding-right: $breadcrumb-item-padding; 17 | padding-left: $breadcrumb-item-padding; 18 | color: $breadcrumb-divider-color; 19 | content: "#{$breadcrumb-divider}"; 20 | } 21 | 22 | // IE9-11 hack to properly handle hyperlink underlines for breadcrumbs built 23 | // without `
    `s. The `::before` pseudo-element generates an element 24 | // *within* the .breadcrumb-item and thereby inherits the `text-decoration`. 25 | // 26 | // To trick IE into suppressing the underline, we give the pseudo-element an 27 | // underline and then immediately remove it. 28 | + .breadcrumb-item:hover::before { 29 | text-decoration: underline; 30 | } 31 | + .breadcrumb-item:hover::before { 32 | text-decoration: none; 33 | } 34 | 35 | &.active { 36 | color: $breadcrumb-active-color; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/_close.scss: -------------------------------------------------------------------------------- 1 | .close { 2 | float: right; 3 | font-size: $close-font-size; 4 | font-weight: $close-font-weight; 5 | line-height: 1; 6 | color: $close-color; 7 | text-shadow: $close-text-shadow; 8 | opacity: .5; 9 | 10 | @include hover-focus { 11 | color: $close-color; 12 | text-decoration: none; 13 | cursor: pointer; 14 | opacity: .75; 15 | } 16 | } 17 | 18 | // Additional properties for button version 19 | // iOS requires the button element instead of an anchor tag. 20 | // If you want the anchor version, it requires `href="#"`. 21 | // See https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile 22 | 23 | // scss-lint:disable QualifyingElement 24 | button.close { 25 | padding: 0; 26 | cursor: pointer; 27 | background: transparent; 28 | border: 0; 29 | -webkit-appearance: none; 30 | } 31 | // scss-lint:enable QualifyingElement 32 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/_grid.scss: -------------------------------------------------------------------------------- 1 | // Container widths 2 | // 3 | // Set the container width, and override it for fixed navbars in media queries. 4 | 5 | @if $enable-grid-classes { 6 | .container { 7 | @include make-container(); 8 | @include make-container-max-widths(); 9 | } 10 | } 11 | 12 | // Fluid container 13 | // 14 | // Utilizes the mixin meant for fixed width containers, but without any defined 15 | // width for fluid, full width layouts. 16 | 17 | @if $enable-grid-classes { 18 | .container-fluid { 19 | @include make-container(); 20 | } 21 | } 22 | 23 | // Row 24 | // 25 | // Rows contain and clear the floats of your columns. 26 | 27 | @if $enable-grid-classes { 28 | .row { 29 | @include make-row(); 30 | } 31 | 32 | // Remove the negative margin from default .row, then the horizontal padding 33 | // from all immediate children columns (to prevent runaway style inheritance). 34 | .no-gutters { 35 | margin-right: 0; 36 | margin-left: 0; 37 | 38 | > .col, 39 | > [class*="col-"] { 40 | padding-right: 0; 41 | padding-left: 0; 42 | } 43 | } 44 | } 45 | 46 | // Columns 47 | // 48 | // Common styles for small and large grid columns 49 | 50 | @if $enable-grid-classes { 51 | @include make-grid-columns(); 52 | } 53 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/_images.scss: -------------------------------------------------------------------------------- 1 | // Responsive images (ensure images don't scale beyond their parents) 2 | // 3 | // This is purposefully opt-in via an explicit class rather than being the default for all ``s. 4 | // We previously tried the "images are responsive by default" approach in Bootstrap v2, 5 | // and abandoned it in Bootstrap v3 because it breaks lots of third-party widgets (including Google Maps) 6 | // which weren't expecting the images within themselves to be involuntarily resized. 7 | // See also https://github.com/twbs/bootstrap/issues/18178 8 | .img-fluid { 9 | @include img-fluid; 10 | } 11 | 12 | 13 | // Image thumbnails 14 | .img-thumbnail { 15 | padding: $thumbnail-padding; 16 | background-color: $thumbnail-bg; 17 | border: $thumbnail-border-width solid $thumbnail-border-color; 18 | @include border-radius($thumbnail-border-radius); 19 | @include transition($thumbnail-transition); 20 | @include box-shadow($thumbnail-box-shadow); 21 | 22 | // Keep them at most 100% wide 23 | @include img-fluid; 24 | } 25 | 26 | // 27 | // Figures 28 | // 29 | 30 | .figure { 31 | // Ensures the caption's text aligns with the image. 32 | display: inline-block; 33 | } 34 | 35 | .figure-img { 36 | margin-bottom: ($spacer-y / 2); 37 | line-height: 1; 38 | } 39 | 40 | .figure-caption { 41 | font-size: $figure-caption-font-size; 42 | color: $figure-caption-color; 43 | } 44 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/_jumbotron.scss: -------------------------------------------------------------------------------- 1 | .jumbotron { 2 | padding: $jumbotron-padding ($jumbotron-padding / 2); 3 | margin-bottom: $jumbotron-padding; 4 | background-color: $jumbotron-bg; 5 | @include border-radius($border-radius-lg); 6 | 7 | @include media-breakpoint-up(sm) { 8 | padding: ($jumbotron-padding * 2) $jumbotron-padding; 9 | } 10 | } 11 | 12 | .jumbotron-hr { 13 | border-top-color: darken($jumbotron-bg, 10%); 14 | } 15 | 16 | .jumbotron-fluid { 17 | padding-right: 0; 18 | padding-left: 0; 19 | @include border-radius(0); 20 | } 21 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/_media.scss: -------------------------------------------------------------------------------- 1 | .media { 2 | display: flex; 3 | align-items: flex-start; 4 | } 5 | 6 | .media-body { 7 | flex: 1; 8 | } 9 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/_progress.scss: -------------------------------------------------------------------------------- 1 | // Progress animations 2 | @keyframes progress-bar-stripes { 3 | from { background-position: $progress-height 0; } 4 | to { background-position: 0 0; } 5 | } 6 | 7 | // Basic progress bar 8 | .progress { 9 | display: flex; 10 | overflow: hidden; // force rounded corners by cropping it 11 | font-size: $progress-font-size; 12 | line-height: $progress-height; 13 | text-align: center; 14 | background-color: $progress-bg; 15 | @include border-radius($progress-border-radius); 16 | } 17 | .progress-bar { 18 | height: $progress-height; 19 | color: $progress-bar-color; 20 | background-color: $progress-bar-bg; 21 | } 22 | 23 | // Striped 24 | .progress-bar-striped { 25 | @include gradient-striped(); 26 | background-size: $progress-height $progress-height; 27 | } 28 | 29 | // Animated 30 | .progress-bar-animated { 31 | animation: progress-bar-stripes $progress-bar-animation-timing; 32 | } 33 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/_responsive-embed.scss: -------------------------------------------------------------------------------- 1 | // Credit: Nicolas Gallagher and SUIT CSS. 2 | 3 | .embed-responsive { 4 | position: relative; 5 | display: block; 6 | width: 100%; 7 | padding: 0; 8 | overflow: hidden; 9 | 10 | &::before { 11 | display: block; 12 | content: ""; 13 | } 14 | 15 | .embed-responsive-item, 16 | iframe, 17 | embed, 18 | object, 19 | video { 20 | position: absolute; 21 | top: 0; 22 | bottom: 0; 23 | left: 0; 24 | width: 100%; 25 | height: 100%; 26 | border: 0; 27 | } 28 | } 29 | 30 | .embed-responsive-21by9 { 31 | &::before { 32 | padding-top: percentage(9 / 21); 33 | } 34 | } 35 | 36 | .embed-responsive-16by9 { 37 | &::before { 38 | padding-top: percentage(9 / 16); 39 | } 40 | } 41 | 42 | .embed-responsive-4by3 { 43 | &::before { 44 | padding-top: percentage(3 / 4); 45 | } 46 | } 47 | 48 | .embed-responsive-1by1 { 49 | &::before { 50 | padding-top: percentage(1 / 1); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/_transitions.scss: -------------------------------------------------------------------------------- 1 | .fade { 2 | opacity: 0; 3 | @include transition($transition-fade); 4 | 5 | &.show { 6 | opacity: 1; 7 | } 8 | } 9 | 10 | .collapse { 11 | display: none; 12 | &.show { 13 | display: block; 14 | } 15 | } 16 | 17 | tr { 18 | &.collapse.show { 19 | display: table-row; 20 | } 21 | } 22 | 23 | tbody { 24 | &.collapse.show { 25 | display: table-row-group; 26 | } 27 | } 28 | 29 | .collapsing { 30 | position: relative; 31 | height: 0; 32 | overflow: hidden; 33 | @include transition($transition-collapse); 34 | } 35 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/_utilities.scss: -------------------------------------------------------------------------------- 1 | @import "utilities/align"; 2 | @import "utilities/background"; 3 | @import "utilities/borders"; 4 | @import "utilities/clearfix"; 5 | @import "utilities/display"; 6 | @import "utilities/flex"; 7 | @import "utilities/float"; 8 | @import "utilities/position"; 9 | @import "utilities/screenreaders"; 10 | @import "utilities/sizing"; 11 | @import "utilities/spacing"; 12 | @import "utilities/text"; 13 | @import "utilities/visibility"; 14 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_alert.scss: -------------------------------------------------------------------------------- 1 | // Alerts 2 | 3 | @mixin alert-variant($background, $border, $body-color) { 4 | background-color: $background; 5 | border-color: $border; 6 | color: $body-color; 7 | 8 | hr { 9 | border-top-color: darken($border, 5%); 10 | } 11 | .alert-link { 12 | color: darken($body-color, 10%); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_background-variant.scss: -------------------------------------------------------------------------------- 1 | // Contextual backgrounds 2 | 3 | @mixin bg-variant($parent, $color) { 4 | #{$parent} { 5 | background-color: $color !important; 6 | } 7 | a#{$parent} { 8 | @include hover-focus { 9 | background-color: darken($color, 10%) !important; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_badge.scss: -------------------------------------------------------------------------------- 1 | // Badges 2 | 3 | @mixin badge-variant($color) { 4 | background-color: $color; 5 | 6 | &[href] { 7 | @include hover-focus { 8 | background-color: darken($color, 10%); 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_border-radius.scss: -------------------------------------------------------------------------------- 1 | // Single side border-radius 2 | 3 | @mixin border-radius($radius: $border-radius) { 4 | @if $enable-rounded { 5 | border-radius: $radius; 6 | } 7 | } 8 | 9 | @mixin border-top-radius($radius) { 10 | @if $enable-rounded { 11 | border-top-right-radius: $radius; 12 | border-top-left-radius: $radius; 13 | } 14 | } 15 | 16 | @mixin border-right-radius($radius) { 17 | @if $enable-rounded { 18 | border-bottom-right-radius: $radius; 19 | border-top-right-radius: $radius; 20 | } 21 | } 22 | 23 | @mixin border-bottom-radius($radius) { 24 | @if $enable-rounded { 25 | border-bottom-right-radius: $radius; 26 | border-bottom-left-radius: $radius; 27 | } 28 | } 29 | 30 | @mixin border-left-radius($radius) { 31 | @if $enable-rounded { 32 | border-bottom-left-radius: $radius; 33 | border-top-left-radius: $radius; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_cards.scss: -------------------------------------------------------------------------------- 1 | // Card variants 2 | 3 | @mixin card-variant($background, $border) { 4 | background-color: $background; 5 | border-color: $border; 6 | 7 | .card-header, 8 | .card-footer { 9 | background-color: transparent; 10 | } 11 | } 12 | 13 | @mixin card-outline-variant($color) { 14 | background-color: transparent; 15 | border-color: $color; 16 | } 17 | 18 | // 19 | // Inverse text within a card for use with dark backgrounds 20 | // 21 | 22 | @mixin card-inverse { 23 | color: rgba(255,255,255,.65); 24 | 25 | .card-header, 26 | .card-footer { 27 | background-color: transparent; 28 | border-color: rgba(255,255,255,.2); 29 | } 30 | .card-header, 31 | .card-footer, 32 | .card-title, 33 | .card-blockquote { 34 | color: #fff; 35 | } 36 | .card-link, 37 | .card-text, 38 | .card-subtitle, 39 | .card-blockquote .blockquote-footer { 40 | color: rgba(255,255,255,.65); 41 | } 42 | .card-link { 43 | @include hover-focus { 44 | color: $card-link-hover-color; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_clearfix.scss: -------------------------------------------------------------------------------- 1 | @mixin clearfix() { 2 | &::after { 3 | display: block; 4 | content: ""; 5 | clear: both; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_float.scss: -------------------------------------------------------------------------------- 1 | @mixin float-left { 2 | float: left !important; 3 | } 4 | @mixin float-right { 5 | float: right !important; 6 | } 7 | @mixin float-none { 8 | float: none !important; 9 | } 10 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_hover.scss: -------------------------------------------------------------------------------- 1 | @mixin hover { 2 | // TODO: re-enable along with mq4-hover-shim 3 | // @if $enable-hover-media-query { 4 | // // See Media Queries Level 4: https://drafts.csswg.org/mediaqueries/#hover 5 | // // Currently shimmed by https://github.com/twbs/mq4-hover-shim 6 | // @media (hover: hover) { 7 | // &:hover { @content } 8 | // } 9 | // } 10 | // @else { 11 | &:hover { @content } 12 | // } 13 | } 14 | 15 | @mixin hover-focus { 16 | @if $enable-hover-media-query { 17 | &:focus { @content } 18 | @include hover { @content } 19 | } 20 | @else { 21 | &:focus, 22 | &:hover { 23 | @content 24 | } 25 | } 26 | } 27 | 28 | @mixin plain-hover-focus { 29 | @if $enable-hover-media-query { 30 | &, 31 | &:focus { 32 | @content 33 | } 34 | @include hover { @content } 35 | } 36 | @else { 37 | &, 38 | &:focus, 39 | &:hover { 40 | @content 41 | } 42 | } 43 | } 44 | 45 | @mixin hover-focus-active { 46 | @if $enable-hover-media-query { 47 | &:focus, 48 | &:active { 49 | @content 50 | } 51 | @include hover { @content } 52 | } 53 | @else { 54 | &:focus, 55 | &:active, 56 | &:hover { 57 | @content 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_image.scss: -------------------------------------------------------------------------------- 1 | // Image Mixins 2 | // - Responsive image 3 | // - Retina image 4 | 5 | 6 | // Responsive image 7 | // 8 | // Keep images from scaling beyond the width of their parents. 9 | 10 | @mixin img-fluid { 11 | // Part 1: Set a maximum relative to the parent 12 | max-width: 100%; 13 | // Part 2: Override the height to auto, otherwise images will be stretched 14 | // when setting a width and height attribute on the img element. 15 | height: auto; 16 | } 17 | 18 | 19 | // Retina image 20 | // 21 | // Short retina mixin for setting background-image and -size. 22 | 23 | @mixin img-retina($file-1x, $file-2x, $width-1x, $height-1x) { 24 | background-image: url($file-1x); 25 | 26 | // Autoprefixer takes care of adding -webkit-min-device-pixel-ratio and -o-min-device-pixel-ratio, 27 | // but doesn't convert dppx=>dpi. 28 | // There's no such thing as unprefixed min-device-pixel-ratio since it's nonstandard. 29 | // Compatibility info: http://caniuse.com/#feat=css-media-resolution 30 | @media 31 | only screen and (min-resolution: 192dpi), // IE9-11 don't support dppx 32 | only screen and (min-resolution: 2dppx) { // Standardized 33 | background-image: url($file-2x); 34 | background-size: $width-1x $height-1x; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_list-group.scss: -------------------------------------------------------------------------------- 1 | // List Groups 2 | 3 | @mixin list-group-item-variant($state, $background, $color) { 4 | .list-group-item-#{$state} { 5 | color: $color; 6 | background-color: $background; 7 | } 8 | 9 | a.list-group-item-#{$state}, 10 | button.list-group-item-#{$state} { 11 | color: $color; 12 | 13 | .list-group-item-heading { 14 | color: inherit; 15 | } 16 | 17 | @include hover-focus { 18 | color: $color; 19 | background-color: darken($background, 5%); 20 | } 21 | 22 | &.active { 23 | color: #fff; 24 | background-color: $color; 25 | border-color: $color; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_lists.scss: -------------------------------------------------------------------------------- 1 | // Lists 2 | 3 | // Unstyled keeps list items block level, just removes default browser padding and list-style 4 | @mixin list-unstyled { 5 | padding-left: 0; 6 | list-style: none; 7 | } 8 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_nav-divider.scss: -------------------------------------------------------------------------------- 1 | // Horizontal dividers 2 | // 3 | // Dividers (basically an hr) within dropdowns and nav lists 4 | 5 | @mixin nav-divider($color: #e5e5e5) { 6 | height: 1px; 7 | margin: ($spacer-y / 2) 0; 8 | overflow: hidden; 9 | background-color: $color; 10 | } 11 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_navbar-align.scss: -------------------------------------------------------------------------------- 1 | // Navbar vertical align 2 | // 3 | // Vertically center elements in the navbar. 4 | // Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px);` to calculate the appropriate top margin. 5 | 6 | // @mixin navbar-vertical-align($element-height) { 7 | // margin-top: (($navbar-height - $element-height) / 2); 8 | // margin-bottom: (($navbar-height - $element-height) / 2); 9 | // } 10 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_pagination.scss: -------------------------------------------------------------------------------- 1 | // Pagination 2 | 3 | @mixin pagination-size($padding-y, $padding-x, $font-size, $line-height, $border-radius) { 4 | .page-link { 5 | padding: $padding-y $padding-x; 6 | font-size: $font-size; 7 | } 8 | 9 | .page-item { 10 | &:first-child { 11 | .page-link { 12 | @include border-left-radius($border-radius); 13 | } 14 | } 15 | &:last-child { 16 | .page-link { 17 | @include border-right-radius($border-radius); 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_reset-text.scss: -------------------------------------------------------------------------------- 1 | @mixin reset-text { 2 | font-family: $font-family-base; 3 | // We deliberately do NOT reset font-size or word-wrap. 4 | font-style: normal; 5 | font-weight: $font-weight-normal; 6 | letter-spacing: normal; 7 | line-break: auto; 8 | line-height: $line-height-base; 9 | text-align: left; // Fallback for where `start` is not supported 10 | text-align: start; 11 | text-decoration: none; 12 | text-shadow: none; 13 | text-transform: none; 14 | white-space: normal; 15 | word-break: normal; 16 | word-spacing: normal; 17 | } 18 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_resize.scss: -------------------------------------------------------------------------------- 1 | // Resize anything 2 | 3 | @mixin resizable($direction) { 4 | resize: $direction; // Options: horizontal, vertical, both 5 | overflow: auto; // Per CSS3 UI, `resize` only applies when `overflow` isn't `visible` 6 | } 7 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_screen-reader.scss: -------------------------------------------------------------------------------- 1 | // Only display content to screen readers 2 | // 3 | // See: http://a11yproject.com/posts/how-to-hide-content 4 | 5 | @mixin sr-only { 6 | position: absolute; 7 | width: 1px; 8 | height: 1px; 9 | padding: 0; 10 | margin: -1px; 11 | overflow: hidden; 12 | clip: rect(0,0,0,0); 13 | border: 0; 14 | } 15 | 16 | // Use in conjunction with .sr-only to only display content when it's focused. 17 | // 18 | // Useful for "Skip to main content" links; see https://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1 19 | // 20 | // Credit: HTML5 Boilerplate 21 | 22 | @mixin sr-only-focusable { 23 | &:active, 24 | &:focus { 25 | position: static; 26 | width: auto; 27 | height: auto; 28 | margin: 0; 29 | overflow: visible; 30 | clip: auto; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_size.scss: -------------------------------------------------------------------------------- 1 | // Sizing shortcuts 2 | 3 | @mixin size($width, $height: $width) { 4 | width: $width; 5 | height: $height; 6 | } 7 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_table-row.scss: -------------------------------------------------------------------------------- 1 | // Tables 2 | 3 | @mixin table-row-variant($state, $background) { 4 | // Exact selectors below required to override `.table-striped` and prevent 5 | // inheritance to nested tables. 6 | .table-#{$state} { 7 | &, 8 | > th, 9 | > td { 10 | background-color: $background; 11 | } 12 | } 13 | 14 | // Hover states for `.table-hover` 15 | // Note: this is not available for cells or rows within `thead` or `tfoot`. 16 | .table-hover { 17 | $hover-background: darken($background, 5%); 18 | 19 | .table-#{$state} { 20 | @include hover { 21 | background-color: $hover-background; 22 | 23 | > td, 24 | > th { 25 | background-color: $hover-background; 26 | } 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_text-emphasis.scss: -------------------------------------------------------------------------------- 1 | // Typography 2 | 3 | @mixin text-emphasis-variant($parent, $color) { 4 | #{$parent} { 5 | color: $color !important; 6 | } 7 | a#{$parent} { 8 | @include hover-focus { 9 | color: darken($color, 10%) !important; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_text-hide.scss: -------------------------------------------------------------------------------- 1 | // CSS image replacement 2 | @mixin text-hide() { 3 | font: 0/0 a; 4 | color: transparent; 5 | text-shadow: none; 6 | background-color: transparent; 7 | border: 0; 8 | } 9 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_text-truncate.scss: -------------------------------------------------------------------------------- 1 | // Text truncate 2 | // Requires inline-block or block for proper styling 3 | 4 | @mixin text-truncate() { 5 | overflow: hidden; 6 | text-overflow: ellipsis; 7 | white-space: nowrap; 8 | } -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_transforms.scss: -------------------------------------------------------------------------------- 1 | // Applies the given styles only when the browser support CSS3 3D transforms. 2 | @mixin if-supports-3d-transforms() { 3 | @media (-webkit-transform-3d) { 4 | // Old Safari, Old Android 5 | // http://caniuse.com/#feat=css-featurequeries 6 | // https://developer.mozilla.org/en-US/docs/Web/CSS/@media/-webkit-transform-3d 7 | @content; 8 | } 9 | 10 | @supports (transform: translate3d(0,0,0)) { 11 | // The Proper Way: Using a CSS feature query 12 | @content; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/mixins/_visibility.scss: -------------------------------------------------------------------------------- 1 | // Visibility 2 | 3 | @mixin invisible { 4 | visibility: hidden !important; 5 | } 6 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/utilities/_align.scss: -------------------------------------------------------------------------------- 1 | .align-baseline { vertical-align: baseline !important; } // Browser default 2 | .align-top { vertical-align: top !important; } 3 | .align-middle { vertical-align: middle !important; } 4 | .align-bottom { vertical-align: bottom !important; } 5 | .align-text-bottom { vertical-align: text-bottom !important; } 6 | .align-text-top { vertical-align: text-top !important; } 7 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/utilities/_background.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Contextual backgrounds 3 | // 4 | 5 | .bg-faded { 6 | background-color: darken($body-bg, 3%); 7 | } 8 | 9 | @include bg-variant('.bg-primary', $brand-primary); 10 | 11 | @include bg-variant('.bg-success', $brand-success); 12 | 13 | @include bg-variant('.bg-info', $brand-info); 14 | 15 | @include bg-variant('.bg-warning', $brand-warning); 16 | 17 | @include bg-variant('.bg-danger', $brand-danger); 18 | 19 | @include bg-variant('.bg-inverse', $brand-inverse); 20 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/utilities/_borders.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Border 3 | // 4 | 5 | .border-0 { border: 0 !important; } 6 | .border-top-0 { border-top: 0 !important; } 7 | .border-right-0 { border-right: 0 !important; } 8 | .border-bottom-0 { border-bottom: 0 !important; } 9 | .border-left-0 { border-left: 0 !important; } 10 | 11 | // 12 | // Border-radius 13 | // 14 | 15 | .rounded { 16 | @include border-radius($border-radius); 17 | } 18 | .rounded-top { 19 | @include border-top-radius($border-radius); 20 | } 21 | .rounded-right { 22 | @include border-right-radius($border-radius); 23 | } 24 | .rounded-bottom { 25 | @include border-bottom-radius($border-radius); 26 | } 27 | .rounded-left { 28 | @include border-left-radius($border-radius); 29 | } 30 | 31 | .rounded-circle { 32 | border-radius: 50%; 33 | } 34 | 35 | .rounded-0 { 36 | border-radius: 0; 37 | } 38 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/utilities/_clearfix.scss: -------------------------------------------------------------------------------- 1 | .clearfix { 2 | @include clearfix(); 3 | } 4 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/utilities/_display.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Display utilities 3 | // 4 | 5 | @each $breakpoint in map-keys($grid-breakpoints) { 6 | @include media-breakpoint-up($breakpoint) { 7 | $infix: breakpoint-infix($breakpoint, $grid-breakpoints); 8 | 9 | .d#{$infix}-none { display: none !important; } 10 | .d#{$infix}-inline { display: inline !important; } 11 | .d#{$infix}-inline-block { display: inline-block !important; } 12 | .d#{$infix}-block { display: block !important; } 13 | .d#{$infix}-table { display: table !important; } 14 | .d#{$infix}-table-cell { display: table-cell !important; } 15 | .d#{$infix}-flex { display: flex !important; } 16 | .d#{$infix}-inline-flex { display: inline-flex !important; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/utilities/_float.scss: -------------------------------------------------------------------------------- 1 | @each $breakpoint in map-keys($grid-breakpoints) { 2 | @include media-breakpoint-up($breakpoint) { 3 | $infix: breakpoint-infix($breakpoint, $grid-breakpoints); 4 | 5 | .float#{$infix}-left { @include float-left; } 6 | .float#{$infix}-right { @include float-right; } 7 | .float#{$infix}-none { @include float-none; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/utilities/_position.scss: -------------------------------------------------------------------------------- 1 | // Positioning 2 | 3 | .fixed-top { 4 | position: fixed; 5 | top: 0; 6 | right: 0; 7 | left: 0; 8 | z-index: $zindex-fixed; 9 | } 10 | 11 | .fixed-bottom { 12 | position: fixed; 13 | right: 0; 14 | bottom: 0; 15 | left: 0; 16 | z-index: $zindex-fixed; 17 | } 18 | 19 | .sticky-top { 20 | position: sticky; 21 | top: 0; 22 | z-index: $zindex-sticky; 23 | } 24 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/utilities/_screenreaders.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Screenreaders 3 | // 4 | 5 | .sr-only { 6 | @include sr-only(); 7 | } 8 | 9 | .sr-only-focusable { 10 | @include sr-only-focusable(); 11 | } 12 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/utilities/_sizing.scss: -------------------------------------------------------------------------------- 1 | // Width and height 2 | 3 | @each $prop, $abbrev in (width: w, height: h) { 4 | @each $size, $length in $sizes { 5 | .#{$abbrev}-#{$size} { #{$prop}: $length !important; } 6 | } 7 | } 8 | 9 | .mw-100 { max-width: 100% !important; } 10 | .mh-100 { max-height: 100% !important; } 11 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/bootstrap/utilities/_visibility.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Visibility utilities 3 | // 4 | 5 | .invisible { 6 | @include invisible(); 7 | } 8 | 9 | // Responsive visibility utilities 10 | 11 | @each $bp in map-keys($grid-breakpoints) { 12 | .hidden-#{$bp}-up { 13 | @include media-breakpoint-up($bp) { 14 | display: none !important; 15 | } 16 | } 17 | .hidden-#{$bp}-down { 18 | @include media-breakpoint-down($bp) { 19 | display: none !important; 20 | } 21 | } 22 | } 23 | 24 | 25 | // Print utilities 26 | // 27 | // Media queries are placed on the inside to be mixin-friendly. 28 | 29 | .visible-print-block { 30 | display: none !important; 31 | 32 | @media print { 33 | display: block !important; 34 | } 35 | } 36 | .visible-print-inline { 37 | display: none !important; 38 | 39 | @media print { 40 | display: inline !important; 41 | } 42 | } 43 | .visible-print-inline-block { 44 | display: none !important; 45 | 46 | @media print { 47 | display: inline-block !important; 48 | } 49 | } 50 | 51 | .hidden-print { 52 | @media print { 53 | display: none !important; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/custom/alerts-custom.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Custom alerts 3 | // 4 | 5 | .alert-dark { 6 | @include alert-variant(rgba(0,0,0,.9), rgba(0,0,0,.8), #fff); 7 | .close { 8 | text-shadow: 0 1px 0 #000; 9 | } 10 | .close:hover, .close:focus { 11 | color: #fff; 12 | } 13 | } 14 | 15 | .alert-full { 16 | border-radius: 0; 17 | } 18 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/custom/buttons-custom.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Custom button styles 3 | // 4 | .btn { 5 | text-transform: $btn-text-transform; 6 | letter-spacing: $btn-letter-spacing; 7 | } 8 | .btn-borderless { 9 | border: 0; 10 | } 11 | 12 | 13 | .btn-xs { 14 | @include button-size($btn-padding-y-sm, $btn-padding-x-sm, $font-size-xs, $btn-border-radius-sm); 15 | } 16 | 17 | 18 | 19 | // More buttons 20 | .btn-more:after { 21 | position: relative; 22 | top: 1px; 23 | content: '〉'; 24 | display: inline-block; 25 | padding-left: .3em; 26 | color: inherit; 27 | } 28 | 29 | // 30 | // Custom button groups 31 | // 32 | .btn-toolbar { 33 | .btn-toolbar-item { 34 | float: left; 35 | } 36 | 37 | > .btn-toolbar-item { 38 | margin-left: 5px; 39 | } 40 | } 41 | 42 | .btn-toolbar-divider { 43 | float: left; 44 | width: 1px; 45 | height: 34px; 46 | margin-left: 10px; 47 | margin-right: 5px; 48 | background-color: $btn-toolbar-divider-bg; // @eee 49 | } 50 | 51 | .btn-group-justified { 52 | &.btn-group-justified-spaced { 53 | width: calc(100% + 10px); 54 | margin-left: -5px; 55 | border-spacing: 5px; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/custom/buttons-radius.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Custom button radius sizes 3 | // 4 | 5 | .btn-pill { 6 | padding-left: 1.25em; 7 | padding-right: 1.25em; 8 | border-radius: 1000em; 9 | } 10 | 11 | .btn-square { 12 | border-radius: 0; 13 | } 14 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/custom/container-custom.scss: -------------------------------------------------------------------------------- 1 | .container-fill-height { 2 | display: table; 3 | width: 100%; 4 | height: 100vh; 5 | 6 | .container-content-bottom, 7 | .container-content-middle { 8 | display: table-cell; 9 | vertical-align: middle; 10 | } 11 | 12 | .container-content-bottom { 13 | vertical-align: bottom; 14 | } 15 | } 16 | 17 | .container-fluid-spacious { 18 | @include media-breakpoint-up(sm) { 19 | padding-right: 40px; 20 | padding-left: 40px; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/custom/divider.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Divided heading 3 | // 4 | 5 | .hr-divider { 6 | position: relative; 7 | font-size: 12px; 8 | line-height: 20px; 9 | text-align: center; 10 | text-transform: uppercase; 11 | 12 | &:before { 13 | position: absolute; 14 | top: 50%; 15 | display: block; 16 | content: ""; 17 | width: 100%; 18 | height: 1px; 19 | background-color: $hr-divider-before-bg; // #eee; 20 | } 21 | } 22 | 23 | .hr-divider-content { 24 | position: relative; 25 | z-index: 2; 26 | display: inline-block; 27 | padding-left: 1em; 28 | padding-right: 1em; 29 | color: $hr-divider-content-color; 30 | vertical-align: middle; 31 | background-color: $hr-divider-content-bg; 32 | 33 | .nav-item { 34 | float: left; 35 | } 36 | } 37 | 38 | .hr-divider-heading { 39 | margin-top: 0; 40 | margin-bottom: 0; 41 | font-size: 100%; 42 | color: inherit; 43 | } 44 | 45 | .hr-divider-nav { 46 | > li > a { 47 | padding-top: 4px; 48 | padding-bottom: 4px; 49 | font-size: 100%; 50 | } 51 | 52 | > .active > a { 53 | font-weight: 300; 54 | background: transparent; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/custom/flex-table.scss: -------------------------------------------------------------------------------- 1 | // 2 | // flex table 3 | // 4 | 5 | .flextable { 6 | dislay: table; 7 | width: 100%; 8 | } 9 | 10 | .flextable-item { 11 | display: table-cell; 12 | width: 1%; 13 | white-space: nowrap; 14 | vertical-align: middle; 15 | 16 | .btn-group { 17 | margin-left: 10px; 18 | } 19 | } 20 | 21 | .flextable-primary { 22 | width: 99%; 23 | } 24 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/custom/graphs.scss: -------------------------------------------------------------------------------- 1 | canvas { 2 | display: block; 3 | } 4 | 5 | .ex-graph { 6 | display: block; 7 | margin: 0 auto 15px; 8 | } 9 | 10 | .ex-line-graph { 11 | width: 100%; 12 | height: 273px; 13 | } 14 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/custom/input-icon.scss: -------------------------------------------------------------------------------- 1 | // Icon inputs 2 | // 3 | // Overlay an icon on the top of a form control. Similar to the input groups 4 | // and their appended add-ons, except these sit on top of the inputs. 5 | 6 | .input-with-icon { 7 | position: relative; 8 | display: inline-block; 9 | vertical-align: middle; 10 | 11 | > .form-control { 12 | padding-left: 30px; 13 | } 14 | 15 | > .icon { 16 | position: absolute; 17 | top: 7px; 18 | left: 10px; 19 | color: #ccc; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/custom/list-group-custom.scss: -------------------------------------------------------------------------------- 1 | // 2 | // List group exentions 3 | // 4 | 5 | // Header (like panels) 6 | .list-group-header { 7 | display: block; 8 | padding: 1rem 1.25rem; 9 | margin-bottom: -1px; 10 | font-weight: 400; 11 | color: $list-group-header-color; // inherit; 12 | background-color: transparent; 13 | border: 1px solid $list-group-border-color; 14 | 15 | // Round the first and last items 16 | &:first-child { 17 | @include border-top-radius($list-group-border-radius); 18 | } 19 | &:last-child { 20 | margin-bottom: 0; 21 | @include border-bottom-radius($list-group-border-radius); 22 | } 23 | } 24 | 25 | 26 | // Background progress bar 27 | .list-group-progress { 28 | position: absolute; 29 | top: 0; 30 | bottom: 0; 31 | left: 0; 32 | z-index: -1; 33 | display: block; 34 | background-color: darken($body-bg, 3%); 35 | } 36 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/custom/modals-custom.scss: -------------------------------------------------------------------------------- 1 | // Modal extensions 2 | // 3 | // For tweaking scrolling, positioning, and more. 4 | 5 | .modal-body-scroller { 6 | max-height: 500px; 7 | overflow: auto; 8 | @include border-radius($border-radius-lg); 9 | } 10 | 11 | .modal-body + .modal-body { 12 | border-top: 1px solid $modal-footer-border-color; 13 | } 14 | 15 | 16 | // Modal actions 17 | // 18 | // Split equal width buttons at the bottom of modals, in place of modal footers. 19 | 20 | .modal-actions { 21 | @include clearfix; 22 | } 23 | 24 | .modal-action { 25 | float: left; 26 | width: 50%; 27 | padding: $modal-inner-padding; 28 | border: solid $modal-footer-border-color; 29 | border-width: 1px 0 0; 30 | 31 | + .modal-action { 32 | border-left-width: 1px; 33 | } 34 | 35 | &:first-child { 36 | border-bottom-left-radius: ($border-radius-lg - 1); 37 | } 38 | 39 | &:last-child { 40 | border-bottom-right-radius: ($border-radius-lg - 1); 41 | } 42 | 43 | &:hover, 44 | &:focus, 45 | &:active { 46 | text-decoration: none; 47 | background-color: #f5f5f5; 48 | border-color: $modal-footer-border-color; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/custom/nav-heading.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Nav header 3 | // 4 | 5 | .nav { 6 | > .nav-header { 7 | padding-left: 15px; 8 | padding-right: 15px; 9 | margin-bottom: 5px; 10 | font-size: 85%; 11 | font-weight: normal; 12 | letter-spacing: 1px; 13 | color: $nav-header-color; // lighten(@gray, 35%); 14 | text-transform: uppercase; 15 | } 16 | 17 | > li + .nav-header { 18 | margin-top: 20px; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/custom/navs-custom.scss: -------------------------------------------------------------------------------- 1 | .nav-pills { 2 | > li { 3 | &.active > a { 4 | &, 5 | &:hover, 6 | &:focus { 7 | font-weight: $nav-pills-active-weight; 8 | } 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/custom/statlist.scss: -------------------------------------------------------------------------------- 1 | .statlist { 2 | margin-bottom: 20px; 3 | padding-left: 0; 4 | list-style: none; 5 | border-bottom: 1px solid $statlist-border-color; // #e5e5e5; 6 | } 7 | 8 | .statlist-link { 9 | position: relative; 10 | display: block; 11 | padding: 10px; 12 | color: $statlist-link-color; // inherit 13 | border-top: 1px solid $statlist-border-color; // #e5e5e5; 14 | } 15 | 16 | .statlist-progress { 17 | position: absolute; 18 | top: 0; 19 | bottom: 0; 20 | left: 0; 21 | z-index: -1; 22 | display: block; 23 | background-color: $statlist-progress-bg; // #f5f5f5; 24 | } 25 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/custom/tables-custom.scss: -------------------------------------------------------------------------------- 1 | .table-full { 2 | @include media-breakpoint-up(sm) { 3 | margin-right: (($grid-gutter-width / -2) - 1); 4 | margin-left: (($grid-gutter-width / -2) - 1); 5 | } 6 | } 7 | 8 | // Toolbar type thing above tables 9 | .table-actions { 10 | padding-bottom: 15px; 11 | } 12 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/custom/tablesorter.scss: -------------------------------------------------------------------------------- 1 | .table .header { 2 | padding-right: 20px; 3 | font-weight: 300; 4 | 5 | &:hover { 6 | cursor: pointer; 7 | } 8 | } 9 | 10 | .headerSortUp, 11 | .headerSortDown { 12 | white-space: nowrap; 13 | cursor: pointer; 14 | font-weight: 700 !important; 15 | color: $brand-primary !important; 16 | border-bottom-color: $brand-primary !important; 17 | 18 | &:after { 19 | display: inline-block; 20 | width: 0; 21 | height: 0; 22 | content: ""; 23 | margin-right: -10px; 24 | margin-bottom: 2px; 25 | margin-left: 5px; 26 | border-right: $tooltip-arrow-width solid transparent; 27 | border-left: $tooltip-arrow-width solid transparent; 28 | } 29 | } 30 | 31 | .headerSortUp:after { 32 | border-top: $tooltip-arrow-width solid; 33 | } 34 | 35 | .headerSortDown:after { 36 | border-bottom: $tooltip-arrow-width solid; 37 | } 38 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/custom/text-inherit.scss: -------------------------------------------------------------------------------- 1 | .text-inherit { 2 | &, 3 | &:hover, 4 | &:focus { 5 | color: inherit; 6 | text-decoration: inherit; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/custom/utilities-spacer.scss: -------------------------------------------------------------------------------- 1 | // Position Utilities 2 | // ------------------------- 3 | .pos-r { position: relative !important; } 4 | .pos-a { position: absolute !important; } 5 | .pos-f { position: fixed !important; } 6 | 7 | 8 | // Constrain utilities 9 | // ------------------------- 10 | .w-1 { width: 25% !important; } 11 | .w-2 { width: 50% !important; } 12 | .w-3 { width: 75% !important; } 13 | .w-full { width: 100% !important; } 14 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/docs.scss: -------------------------------------------------------------------------------- 1 | // generate docs css 2 | 3 | @import "./variables-inverse.scss"; 4 | @import "./bootstrap/_mixins.scss"; 5 | @import "./custom/syntax.scss"; 6 | @import "./custom/docs.scss"; 7 | 8 | // Link colors in the table of contents and back to top button 9 | .docs-top, 10 | #markdown-toc a { 11 | color: lighten($body-bg, 45%); 12 | 13 | &:hover { 14 | color: #fff; 15 | } 16 | } 17 | 18 | .docs-example { 19 | background-color: transparent; 20 | border-color: $gray-darker; 21 | 22 | &.docs-example-modal, 23 | &.bs-example-popover { 24 | background-color: rgba(0,0,0,.1); 25 | } 26 | } 27 | 28 | .highlight { 29 | background-color: darken($body-bg, 5%); 30 | border: 0; 31 | 32 | pre code { 33 | color: #999; 34 | } 35 | } 36 | 37 | .docs-example .iconav { 38 | position: relative !important; 39 | } 40 | 41 | .docs-content > h2, 42 | .docs-content > h1 { 43 | margin-top: 50px; 44 | } 45 | .docs-content > h1 + h2 { 46 | margin-top: 10px; 47 | } 48 | -------------------------------------------------------------------------------- /static/vendor/bootstrap-theme/scss/toolkit-light.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Imports 3 | // 4 | 5 | @import "./variables.scss"; 6 | @import "./components.scss"; 7 | -------------------------------------------------------------------------------- /static/vendor/bootstrap/v3/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/static/vendor/bootstrap/v3/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /static/vendor/bootstrap/v3/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/static/vendor/bootstrap/v3/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /static/vendor/bootstrap/v3/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/static/vendor/bootstrap/v3/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /static/vendor/bootstrap/v3/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/static/vendor/bootstrap/v3/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /static/vendor/bootstrap/v3/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /static/vendor/bootstrap/v3/version=3.3.6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/static/vendor/bootstrap/v3/version=3.3.6 -------------------------------------------------------------------------------- /static/vendor/bootstrap/version=4.0.0-alpha.6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/static/vendor/bootstrap/version=4.0.0-alpha.6 -------------------------------------------------------------------------------- /static/vendor/tether/.gitignore: -------------------------------------------------------------------------------- 1 | .sass-cache 2 | node_modules/ 3 | deps/ 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /static/vendor/tether/.hsdoc: -------------------------------------------------------------------------------- 1 | name: "Tether" 2 | description: "Marrying DOM elements for life" 3 | domain: "tether.io" 4 | source: "coffee/*.coffee" 5 | examples: "**/*.md" 6 | assets: "{dist/js/*.js,dist/css/*.css,docs/css/*.css,docs/js/*,js,docs/welcome/*,examples/*}" 7 | -------------------------------------------------------------------------------- /static/vendor/tether/css/tether-theme-basic.css: -------------------------------------------------------------------------------- 1 | .tether-element, .tether-element:after, .tether-element:before, .tether-element *, .tether-element *:after, .tether-element *:before { 2 | box-sizing: border-box; } 3 | 4 | .tether-element { 5 | position: absolute; 6 | display: none; } 7 | .tether-element.tether-open { 8 | display: block; } 9 | 10 | .tether-element.tether-theme-basic { 11 | max-width: 100%; 12 | max-height: 100%; } 13 | .tether-element.tether-theme-basic .tether-content { 14 | border-radius: 5px; 15 | box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); 16 | font-family: inherit; 17 | background: #fff; 18 | color: inherit; 19 | padding: 1em; 20 | font-size: 1.1em; 21 | line-height: 1.5em; } 22 | -------------------------------------------------------------------------------- /static/vendor/tether/css/tether-theme-basic.min.css: -------------------------------------------------------------------------------- 1 | .tether-element,.tether-element *,.tether-element :after,.tether-element :before,.tether-element:after,.tether-element:before{box-sizing:border-box}.tether-element{position:absolute;display:none}.tether-element.tether-open{display:block}.tether-element.tether-theme-basic{max-width:100%;max-height:100%}.tether-element.tether-theme-basic .tether-content{border-radius:5px;box-shadow:0 2px 8px rgba(0,0,0,.2);font-family:inherit;background:#fff;color:inherit;padding:1em;font-size:1.1em;line-height:1.5em} -------------------------------------------------------------------------------- /static/vendor/tether/css/tether.css: -------------------------------------------------------------------------------- 1 | .tether-element, .tether-element:after, .tether-element:before, .tether-element *, .tether-element *:after, .tether-element *:before { 2 | box-sizing: border-box; } 3 | 4 | .tether-element { 5 | position: absolute; 6 | display: none; } 7 | .tether-element.tether-open { 8 | display: block; } 9 | -------------------------------------------------------------------------------- /static/vendor/tether/css/tether.min.css: -------------------------------------------------------------------------------- 1 | .tether-element,.tether-element *,.tether-element :after,.tether-element :before,.tether-element:after,.tether-element:before{box-sizing:border-box}.tether-element{position:absolute;display:none}.tether-element.tether-open{display:block} -------------------------------------------------------------------------------- /static/vendor/tether/version=1.3.3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/static/vendor/tether/version=1.3.3 -------------------------------------------------------------------------------- /taskapp/README.md: -------------------------------------------------------------------------------- 1 | # ITF Celery tasks queue 2 | 3 | Our Celery installation use RabbitMQ broker transport [CloudAMQP heroku add-on](https://elements.heroku.com/addons/cloudamqp). 4 | 5 | * [Celery](http://www.celeryproject.org/) 6 | * [Heroku Celery guide](https://devcenter.heroku.com/articles/celery-heroku) 7 | 8 | ## Celery workers 9 | Heroku can run up to 8 workers in parallel in one dyno, but we run 4 (--concurrency=4), because of memory limitaions. 10 | We use 2 dynos with workers. If more needed - just increase number of heroku dynos. Celery will recognize new dyno and distribute tasks automatically. 11 | 12 | ## Celery scheduler 13 | We use [RedBeat](https://github.com/sibson/redbeat) as a Celery Beat Scheduler. It stores data in Redis. [Heroku Redis](https://elements.heroku.com/addons/heroku-redis) 14 | 15 | Standard Celery Beat Scheduler saves state in the file and not works great with heroku. 16 | 17 | ## Requirements 18 | 19 | * [Celery](http://docs.celeryproject.org/en/v4.1.0/django/index.html) 20 | * [RedBeat](https://github.com/sibson/redbeat) 21 | 22 | ## Environment variables 23 | 24 | * CELERY_BROKER_URL - url of our redis server (Heroku Redis) 25 | 26 | ## Files 27 | Celery installed in taskapp/ folder. 28 | 29 | * taskapp/celery.py - entry point to Celery 30 | * taskapp/tasks.py - thin wrappers for tasks 31 | * taskapp/helpers/* - tasks 32 | -------------------------------------------------------------------------------- /taskapp/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, unicode_literals 2 | 3 | # This will make sure the app is always imported when 4 | # Django starts so that shared_task will use this app. 5 | from taskapp.celery import app as celery_app 6 | 7 | __all__ = ('celery_app',) 8 | -------------------------------------------------------------------------------- /taskapp/helpers/__init__.py: -------------------------------------------------------------------------------- 1 | from taskapp.helpers.common import get_exchanges, get_tickers, get_source_name, quad_formatted 2 | 3 | from taskapp.helpers.indicators import _compute_ann, _compute_indicators_for 4 | 5 | from taskapp.helpers.backtesting import _backtest_all_strategies 6 | -------------------------------------------------------------------------------- /taskapp/helpers/sentiment_analysis.py: -------------------------------------------------------------------------------- 1 | import time 2 | from apps.sentiment.models.sentiment import Sentiment 3 | 4 | def _analyze_sentiment(): 5 | timestamp = time.time() // (1 * 60) * (1 * 60) # current time rounded to a minute 6 | Sentiment.compute_all(timestamp) -------------------------------------------------------------------------------- /taskapp/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/taskapp/tests/__init__.py -------------------------------------------------------------------------------- /taskapp/tests/test_helpers.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import unittest 3 | 4 | from django.test import SimpleTestCase 5 | 6 | from taskapp.helpers.common import get_source_name 7 | 8 | 9 | 10 | class TestHelpers(SimpleTestCase): 11 | 12 | def test_get_source_name(self): 13 | self.assertEqual(get_source_name(0), 'poloniex') 14 | self.assertEqual(get_source_name(2), 'binance') 15 | -------------------------------------------------------------------------------- /templates/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelligentTrading/core/c6bafe6cebdb99d47dfb7cb4a5e2a32ae3a272ff/templates/__init__.py -------------------------------------------------------------------------------- /templates/account/email/email_confirmation_message.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | 3 | Please continue here to verify you account: {{ activate_url }} 4 | -------------------------------------------------------------------------------- /templates/account/email/email_confirmation_signup_subject.txt: -------------------------------------------------------------------------------- 1 | Verify account 2 | -------------------------------------------------------------------------------- /templates/messages.html: -------------------------------------------------------------------------------- 1 |
    2 | {% for message in messages %} 3 | 4 | 14 | 15 | {% endfor %} 16 |
    17 | -------------------------------------------------------------------------------- /templates/messages/message.mustache: -------------------------------------------------------------------------------- 1 |
  • 3 | 13 |
  • 14 | -------------------------------------------------------------------------------- /templates/navigation.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | -------------------------------------------------------------------------------- /vendorlibs/pyqs/__init__.py: -------------------------------------------------------------------------------- 1 | from .decorator import task # noqa 2 | 3 | __title__ = 'pyqs' 4 | __version__ = '0.0.18' 5 | -------------------------------------------------------------------------------- /vendorlibs/pyqs/utils.py: -------------------------------------------------------------------------------- 1 | import base64 2 | import json 3 | import pickle 4 | 5 | 6 | def decode_message(message): 7 | message_body = message.get_body() 8 | return json.loads(message_body) 9 | 10 | # Don't pretend to support celery msgs 11 | # def decode_celery_message(json_task): 12 | # message = base64.decodestring(json_task['body']) 13 | # try: 14 | # return json.loads(message) 15 | # except ValueError: 16 | # pass 17 | # return pickle.loads(message) 18 | 19 | 20 | def function_to_import_path(function): 21 | return "{}.{}".format(function.__module__, function.__name__) 22 | --------------------------------------------------------------------------------