• 沒有找到結果。

Python Programming in Finance

N/A
N/A
Protected

Academic year: 2022

Share "Python Programming in Finance"

Copied!
60
0
0

加載中.... (立即查看全文)

全文

(1)

Python Programming in Finance

Zheng-Liang Lu (Arthur)

CSIE @ NTU

(2)

Zheng-Liang Lu

Python

Programming

2

Lecture 1

https://docs.python.org/3.7/

(3)

Zheng-Liang Lu

Program ~ Data + Algorithm

3

(4)

Zheng-Liang Lu

Basic I/O

4

print

input

(5)

Zheng-Liang Lu

Variable

5

(6)

Zheng-Liang Lu

Data Types

6

(7)

Zheng-Liang Lu

String

7

str()

(8)

Zheng-Liang Lu

Type Conversion

8

int()

(9)

Zheng-Liang Lu

Floats

9

float()

(10)

Zheng-Liang Lu

Arithmetic Operators

10

+, -, *, **, /, !//, %

(11)

Zheng-Liang Lu

Numerical Error

11

(12)

Zheng-Liang Lu

Assignment Operator

12

=

(13)

Zheng-Liang Lu

x = x + 1

13

(14)

Zheng-Liang Lu

List

14

[]

(15)

Zheng-Liang Lu

Slicing

15

:

(16)

Zheng-Liang Lu

Append

16

append()

(17)

Zheng-Liang Lu

Deletion

17

del

(18)

Zheng-Liang Lu

More APIs of List

18

help

(19)

Zheng-Liang Lu

Membership of List

19

in

(20)

Zheng-Liang Lu

Boolean Values

20

True False

(21)

Zheng-Liang Lu

Rational Operators

21

<,<=, >, >=, ==, !=

(22)

Zheng-Liang Lu

Logical

Operators

22

and, or, not

(23)

Zheng-Liang Lu

Conditional Statements

23

if-elif-else

(24)

Zheng-Liang Lu

For Loops

24

for

(25)

Zheng-Liang Lu

Range-Based

25

range()

(26)

Zheng-Liang Lu

26

https://www.google.com/doodles/

celebrating-50-years-of-kids-coding

(27)

Zheng-Liang Lu

Monte Carlo

27

EMPP_lec1.pdf

Wiki

(28)

Zheng-Liang Lu https://upload.wikimedia.org/wikipedia/commons/8/84/Pi_30K.gif

28

(29)

Zheng-Liang Lu

While Loops

29

while

(30)

Zheng-Liang Lu

Bisection Method

30

Wiki: bisection method

Wiki: root-finding algorithms

(31)

Zheng-Liang Lu https://upload.wikimedia.org/wikipedia/commons/thumb/8/8c/Bisection_method.svg/1280px-Bisection_method.svg.png

31

(32)

Zheng-Liang Lu

Monte Carlo Again

32

Exercise

(33)

Zheng-Liang Lu

33

(34)

Zheng-Liang Lu

Jump

Statements

34

break continue pass

(35)

Zheng-Liang Lu

Loop

Techniques

35

enumerate() zip()

sorted() reversed()

(36)

Zheng-Liang Lu

Dictionary: Key

& Value

36

{K:V}

(37)

Zheng-Liang Lu

Tuple

37

()

(38)

Zheng-Liang Lu

x, y = y, x

38

(39)

Zheng-Liang Lu

Set with

Operations

39

{}

(40)

Zheng-Liang Lu

Comprehension

40

(41)

Zheng-Liang Lu

Function

41

def return

(42)

Zheng-Liang Lu

Scope

42

globals() locals()

(43)

Zheng-Liang Lu

Default

Argument

43

(44)

Zheng-Liang Lu

Positional &

Keyword Argument

44

(45)

Zheng-Liang Lu

print()

45

Example

(46)

Zheng-Liang Lu

Built-in Functions in Python 3

46

https://docs.python.org/3/library/functions.html

(47)

Zheng-Liang Lu

Lambda

Expression

47

lambda

(48)

Zheng-Liang Lu

48

Functional

Programming

filter()

map()

(49)

Zheng-Liang Lu

Monte Carlo Again!

49

Exercise

(50)

Zheng-Liang Lu

50

(51)

Zheng-Liang Lu

Iterator

51

next()

(52)

Zheng-Liang Lu

Generator

52

yield

(53)

Zheng-Liang Lu

Objects

53

class

(54)

Zheng-Liang Lu

Application:

String

54

“ “

(55)

Zheng-Liang Lu

Application: File I/O

55

with-as

(56)

Zheng-Liang Lu

Application:

Time

56

(57)

Zheng-Liang Lu

Application:

Exception

57

raise

try-except-else-finally

(58)

Zheng-Liang Lu

Importing Packages

58

import from-import

(59)

Zheng-Liang Lu

Package Installation

59 pip install xxx

撥開 Python, pip, site-packages 的藍⾊蜘蛛網 💢

!pip install xxx

!pip !--user install xxx

(60)

Zheng-Liang Lu

https://xkcd.com/1987/ 60

參考文獻

相關文件

• Implied volatility (IV) is the volatility input in a pricing model that, in conjunction with the other four inputs, returns the theoretical value of an option matching the

OPERATIONAL RISK AND RESILIENCY LIQUIDITY AND TREASURY RISK MEASUREMENT AND MANAGEMENT RISK MANAGEMENT AND INVESTMENT MANAGEMENT.. CURRENT ISSUES IN

• You need to know programming (C, python, java, … anything)
 (but not necessarily Matlab).. • You need to know how to find

課程利用雲端學習平台 OpenEdu 從最基礎開始說明 Python 的語 法與應用,配合 Quiz in Video

Household Application Form for Student Financial Assistance Schemes is submitted on or after 1 November 2022 and can pass the means test, payment of STS (if applicable) may be

撥予院校的獎 學金

Micro:Bit AI2 Scratch Mbot Python

三、聯絡電話:(04)23323000 分機 7092~7094 四、網址:http://www.cyut.edu.tw/~finance 五、電子信箱:finance@mail.cyut.edu.tw.. 系所別