Thursday, May 17, 2018

How to: Specify Build Events (C#)

https://msdn.microsoft.com/en-us/library/ke5z92ks.aspx


o specify a build event

  1. In Solution Explorer, select the project for which you want to specify the build event.
  2. On the Project menu, click Properties.
  3. Select the Build Events tab.

copy /Y E:\WealthLab\PriceChannelBreakout\PriceChannelBreakout\bin\Debug\PriceChannelBreakout.dll "C:\Program Files\Fidelity Investments\Wealth-Lab Pro 6\Data\Strategies\GC\*.*"

Monday, May 7, 2018

numpy operations Udemy: Python for finance and trading alogrithms

arr
arr + arr
arr * arr
arr - arr
arr/arr
arr ** 3
arr + 100
np.sqrt(arr)
np.exp(arr)
np.max()
np.max(arr)
np.sin(arr)

numpy Udemy: Python for finance and trading alogrithms

conda install numpy

import numpy as np

NumPy array
#creating Numpy array

myList = [1,2,3]
np.array(myList)
x=np.array(myList)
type(x)

myMatrix=[[1,2,3],[4,5,6],[7,8,9]]

np.arange(0,5)
# range with step size
np.arange(0,11,2)

#float number
np.zeros(3)
np.zeros((3,3))
np.ones(3)
np.linespace
np.linspace(0,10,3)
np.eye(4)
np.random
np.random.rand(5,4)
np.random.randn(5,4)
np.random.randint(1,100)
np.random.randint(1,100,10)
arr = np.arange(25)
ranarr = np.random.randint(0,50,10)
arr.reshape(5,5)
arr.shape
arr.dtype

ranarr.max()
ranarr.argmax()

ranarr.min()


ranarr.argmin()

Udemy: Python for finance and trading alogrithms: syntax


https://www.anaconda.com/download/
download 3.6

https://conda.io/docs/user-guide/tasks/manage-environments.html

conda env create -f environment.yml

activate pyfinance

jupyter notebook

http://localhost:8888/?token=8353cd76ab1525e6aab4b0cf408cac74bf56a05589c68e71


Shift + enter : run
Shift + Tab : doc

define x='12'
x. +tab see all method

name="greg"
print("hi, {}".format(name))
number=12
print("hi, {}, no {}".format(name,number))

print("hi, {x}, {y}".format(y=x,x=no))

#nested list
nested =[1,2,["a","b"]]

#dictionary
d={'key':10, 'key2':'2nd'}
d['key2']

#tuple (can't change items)
t=(1,2,3)

#set
set([1,1])

import math

(1==1) and not (1==2)

# if and else has to on the same column, elif
if 1==2:
    print('hi')
elif 2==2:
    print('2')
else:
    print('3')

#for
seq=[1,2,3,4,5]
for jelly in seq:
   print(jelly)

#while
i=1
while(i<5):
 print('i={}'.format(i))
i=i+1

#range
range(5)

for i in range(0,20,2):
    print(i)

#function
def mF():
  print("hi")

def mF(p):
    print(p)

def mF(p='default'):
    print(p)

def mF(p='default'):
    return(p)

#lambda
lambda var:var*2

seq=[1,2,3]
list(map(lambda var:var*2,seq))

def is_even(num):
    return num%2 ==0
list(filter(is_even,seq))

list(filter(lambda num:num%2==0,seq))

#method
st.lower
st.upper
tweet=" go sp #cool"
tweet,split()
tweet.split('#')[1]
mylist=[1,2,3,4]
mylist.pop()
mylist.pop(1)
2 in mylist

Exercise
prince ** 0.5
import math
math.sqrt(price)

#task 2
stock_index[2:]

task#3
print("the {} is at {}".format(stock_index,price))

task#4
stock_info.keys()
stock_info['sp500']['yesterday']

stock_info['info'][1][2]

task#5
def source_finder(p):
        return  p.split("--")[-1]

def price_finder(p):
    return 'price' in p.lower()


task#6
def count_price(s):
   count = 0
   for word in s.lower().split():
        if 'price' in word:
            count = count + 1
   return count

def count_price(s)
     return s.lower().count('price')

task#7
def avg_price(s):
    return sum(s)/len(s)