Showing posts with label Anaconda. Show all posts
Showing posts with label Anaconda. Show all posts

Sunday, March 4, 2018

5 Steps To Start Simple Stock Prediction | Python 3.6.4| Code Demo| Mar 2018



00:29 - 08:35 | Get Web Data + Preprocessing
08:35 - 19:18 | Make Data Table + Define Target
19:18 - 25:50 | Define Triggering Event
25:51 - 27:03 | Rough Interpretation

How to install Anaconda
https://www.youtube.com/watch?v=omr8sETbIiA&list=PLgBXjIucQF7YHwVXhOlM13iNHgoUJyPNb&index=7

Create Virtual Environment
https://www.youtube.com/watch?v=CxoynHV5DGs&list=PLgBXjIucQF7YHwVXhOlM13iNHgoUJyPNb&index=8

Disclaimer
The blog is provided as is, without warranty of any kind, neither expressed or implied,
including without limitation warranties of merchantability, fitness for a particular
purpose, title, security, accuracy and non-infringement.
Creator(s) make(s) no warranty or representation,
either expressed or implied, that any contents stated in this blog is error-free.

Use of the blog is at your own risk.  You assume full responsibility and risk of loss
resulting from your downloading, transfer, understanding, and/or use of files,
information, other communications, content, or other material, including,
without limitation software, accessed through or obtained by means of the blog.

www.facebook.com/clueple

errata
Calculation shown from 17:17 to 17:41 should be
(24608 - 25029 ) divided by 25029, instead of 25022


Sunday, February 25, 2018

Install Dash By Plotly On Anaconda3 Windows 10 | Feb 2018

#install_dash_on_anaconda,

Step A:
a.1 -> Start Anaconda Prompt
a.2 ->Type 'activate [fill in your_environment here]' (like ref a on image) to go your environment.
(In case you don't have any environment, simply install to (base))
a.3 -> pip install dash... (follow the installation page but type on the same line instead)
e.g.
what it shows on the installation page is as follows:

pip install dash==0.21.0  # The core dash backend
pip install dash-renderer==0.11.3  # The dash front-end
pip install dash-html-components==0.9.0  # HTML components
pip install dash-core-components==0.18.1  # Supercharged components
pip install plotly --upgrade  # Plotly graphing library used in examples 

Then you should type the following on your Anaconda Prompt environment (as shown on image ref (a):

pip install dash==0.21.0 dash-renderer==0.11.3 dash-html-components==0.9.0 dash-core-components==0.18.1 plotly -- upgrade

(All in one line, pay attention to space and strokes otherwise you won't install successfully.)

Step B:
Once you finish installation, you can check whether it's done successfully by
typing 'pip list' inside your environment (e.g. myTrade or base)

Step C:
You can now start coding Dash.
When you hit run (e.g. [F5] in Python Idle),
you will see [whatever server is running ] on your Anaconda Prompt (see ref (c) on image)

Then you need to open a new browser (as shown as ref (c) on image)
to view your coding results.


Click to view photos

Tuesday, November 14, 2017

Run Python With VSCode On USB | Anaconda Envs| Windows 10| 2017-11-14

Why Use Visual Studio Code

I am happy with Sublime Text 3 for my Python coding.
But since VSCode is free, I'd like to give it a try.
To be honest, the task runner setup was more complicated that I expected.

Anyhow, I managed to set this up on a USB.

Python Environment

1) Python 3.6.3 - Anaconda , with environment being created with Anaconda Navigator
2) Operating System: Windows 10 

Steps

1) Install Anaconda (location being set to D drive (drive other than default C))

2) Create Environment With Anaconda Navigator (Optional)
This step is optional if you're happy with the Anaconda root installation.
I tend to create different projects in different environments (Python virtual environment),
just a matter of habit.

 
3) Download VSCode and Setup
This can be quite tricky when you need to setup the task runner to run Python code.


Friday, November 10, 2017

Create Python Backtest With Jupyter Notebook Anaconda 3.5.0.1 On Windows 10| 2017-11-11

Backtest With Jupyter Notebook Anaconda 3.5.0.1


Just walkthrough the whole process of creating Python backtest in Anaconda, Windows 10.

The process is broken down into 5 major steps:
00x | Install Anaconda
10x | Get online stock (e.g. AAPL) | Market Data
20x | Create trade strategy | Strategy Class
30x | Generate trade signal | Signal Class
40x | Create investment portfolio | Portfolio Class
50x | Perfomance review | PnL + Graphing

A timeline is provided below for easy navigation:
In case you just want to use the Anaconda root setup, skip step 'Ana002'

mm:ss
00:00 - 03:02 ||Ana001| Install Anaconda
03:04 - 10:02 ||Ana002|Setup different environment other than root - optional step*
10:04 - 19:02 ||Ana101| Get Apple stock data from Yahoo Finance, save to local drive as Excel
19:04 - 29:11 ||Ana201| Create Strategy - calculate moving averages
29:12 - 35:53 ||Ana202| Create Strategy - get stock trend
35:55 - 41:22 ||Ana301| Get Trade Signal and Generate Order
41:24 - 49:50 ||Ana401402| Create Investment Portfolio and Trade Details
49:52 - 59:03 ||Ana501502| Calculate Profit and Loss and Graphing

* install optional Python packages that your project requires
** the strategy mentioned assumes zero borrowing cost so that whenever short position occurs,
we can borrow unlimited amount of money without needing to pay a penny of interest.
This is not real in real world.  So just be aware of that.


Here's the 59-min video(Complete Walkthrough - Jupyter Notebook Anaconda):



*** this video is rendered in 1.05x speed; feel free to visit the original speed videos below.

Install Anaconda 3.5.0.1(Ana001)


Setup Environment In Anaconda 3.5.0.1(Ana002) - Optional



Get Online Stock Data + Save To Local Drive(Ana101) 


Form Trade Strategy - Calculate Moving Average (Ana201) 



Form Trade Strategy - Get Stock Trend (Ana202) 


Generate Trade Signal - Get Stock Trend (Ana301)


Create Investment Portfolio (Ana401402) 


Measuring Performance & Graphing (Ana501502)


Backtest With Python Default Editor



My Thought

Comparing to buidling Python strategy backtest in default Python editor,
the Anaconda Jupyter Notebook takes a bit of time to get used to.
It takes time to load up the Jupyter Notebook while such load time is minimal in Python default editor.

But from layman's perspective, setting up multiple environments and installing packages
through the Anaconda Navigator are intuitive.
Anaconda basically organizes the folders under the 'env' folder.
That's good folder management.

In the future, I'll try using Sublime Text 3 to route to the Anaconda's environment folder.
See if I can take advantage of Sublime Text' speed while maintaining proper environment folder
management.

If you find this article helpful, feel free to discuss on my Facebook:

www.facebook.com/clueple


Disclaimer:
Everything shown in this video is just the author's personal experience with Anaconda.
All mentioned assumptions and tactics are used as demonstration for education purpose.
Trade details, not limited to, leverage level, deposit amount, transactions fees, and
any costs associated with the strategy are not meant to be complete.

No investment decision should be based on any information provided in this video.
No professional advice are provided or implied whatsoever.

Viewers are solely responsible for any loss associated to consumption of this video.