標籤

二元樹 (1) 字串常數池 (1) 投資 (3) 每月損益 (37) 例外處理 (1) 泛型 (2) 股票 (15) 指標 (5) 英文 (8) 基本資料型別 (1) 期貨 (1) 程式交易 (10) 量化投資 (5) 亂亂寫 (3) 概念 (3) 資料結構 (3) 演算法 (3) 數學 (3) 轉型 (1) AMA (1) ArrayList (1) assert (1) BeautifulSoup (1) C/C++ (8) casting (1) ClassCastException (1) classpath (1) Collection (4) Comparable (1) comparTo() (1) constructor (1) database (3) Debian (1) Dropbox (2) EA (2) enum (1) equals() (2) exception (3) extends (1) ffmpeg (1) final (1) Git (1) HashMap (1) HashSet (1) hasNext() (1) HTS (3) instanceof (1) IS-A (1) Iterator (1) JAVA (43) length (1) Linux (31) List (1) Mac (6) Map (1) ML (2) MT4 (6) MySQL (2) next() (1) NullPointerException (1) Number (1) Numpy (2) OpenCart (1) OpenCV (3) OSX (1) overloading (1) overriding (3) pandas (2) PHP (8) PriorityQueue (1) Python (11) Queue (1) random() (1) reverse() (1) Samba (1) SCJP (21) sqrt() (1) synchronized (1) talib (1) ufw (1) uTorrent (1) var-args (2) VHF (1) vim (2) Yhoo知識+ (4)

2017年2月28日 星期二

2017 2月損益 1647 -66023


2017 2月1647-66023

2017年2月19日 星期日

HTS印出換行

print("|n")

不是什麼print("|r|n"),不要亂教。

2017年2月18日 星期六

2017 1月損益 -11631 -67670


月損益總損益
2016 3月13191319
2016 4月-20676-19357
2016 5月-6115-25472
2016 6月-672-26144
2016 7月-2456-28600
2016 8月221-28379
2016 9月-9913-38292
2016 10月-1508-39800
2016 11月-12113-51913
2016 12月-4126-56039
2017 1月-11631-67670

2017年1月1日 星期日

2016 12月損益 -4126 -56039








2016月損益總損益
2016 3月13191319
2016 4月-20676-19357
2016 5月-6115-25472
2016 6月-672-26144
2016 7月-2456-28600
2016 8月221-28379
2016 9月-9913-38292
2016 10月-1508-39800
2016 11月-12113-51913
2016 12月-4126-56039

2016年12月6日 星期二

range(start,end, scan)


>>> range(5)
[0, 1, 2, 3, 4]
>>> range(1,5)
[1, 2, 3, 4]
>>> range(1,5,2)
[1, 3]

//reshape改陣列維度
import numpy as np

>>> rangeArray = np.arange(6,12)   //set from6 to 11
>>> rangeArray
array([ 6,  7,  8,  9, 10, 11])

>>> rangeArray.reshape((2,3))   //.reshape can change array(6) to array(2,3)
array([[ 6,  7,  8],
       [ 9, 10, 11]])

但reshape只改變沒存檔,所以rangeArray印出來還是一維陣列
>>> rangeArray
array([ 6,  7,  8,  9, 10, 11])

所以要賦值給自己才行
>>> rangeArray = rangeArray.reshape((2,3))
>>> rangeArray
array([[ 6,  7,  8],
       [ 9, 10, 11]])

2016年12月2日 星期五

Python的if

name = "John"

if name == "Bill":
    print ("Hi, %s." % name)
elif name == "Mary":
    print ("Hi, %s." % name)
else:
    print ("Hi, %s." % name)

Hi, John.

Python字串提取

字串的index跟陣列一樣從0開始,若要提取index0到index4,以[0:5]表示,其中5表示你要提取到那個字的後一個index(好麻煩)

>>> str1 = "123456789"
>>> print str1[0:5]
12345      //取index0到 index4

若沒寫則從頭開始或直到最後

>>> print str1[:]     //前後都沒寫就是提全部
123456789
>>> print str1[2:]    //後面沒寫就從2直到最後
3456789
>>> print str1[:2]      //前面沒寫就從0開始
12

若要提取間隔,譬如說我要取單數,那就間隔為2

>>> print str1[::2]
13579       //提取 index 02468

若要取偶數,因為2從index1開始,所以輸入[1::2]
>>> print str1[1::2]
2468      //提取 index 1357

若沒有間隔則不填,要填1也可以,但就是不能填 0,會出現錯誤

>>> print str1[::1]
123456789
>>> print str1[::0]
Traceback (most recent call last):
  File "<pyshell#13>", line 1, in <module>
    print str1[::0]
ValueError: slice step cannot be zero