質問編集履歴

8

補足5

2018/05/14 13:30

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -18,14 +18,6 @@
18
18
 
19
19
  }),
20
20
 
21
- hogeif({
22
-
23
- 'apiKey': 'hoge',
24
-
25
- 'secret': 'hoge',
26
-
27
- }),
28
-
29
21
  hogebank({
30
22
 
31
23
  'apiKey': 'hoge',
@@ -38,28 +30,18 @@
38
30
 
39
31
 
40
32
 
41
- def order_process(arbitrage_decision,best_ask_price,set_ask_volume,target_currency):
33
+ def order_process():
42
34
 
43
- limit_ordered_info = exchange[0].create_order( >>>>>>>>>>>>>>>>>>>>>>>>>[0]を引数として追加したい。
35
+ limit_ordered_info = exchange[0].create_order( >>>>>>>>>>>>>>>>>>>>>>>>>[0]を追加したい。
44
-
45
- symbol= target_currency,
46
-
47
- type='limit',
48
-
49
- side='buy',
50
-
51
- amount= set_ask_volume,
52
-
53
- price= best_ask_price
54
-
55
- )
56
-
57
- print(json.dumps(limit_ordered_info, indent=True))
58
36
 
59
37
  return limit_ordered_info
60
38
 
61
- order_process(arbitrage_decision,best_ask_price,set_ask_volume,target_currency)
39
+ order_process()
62
40
 
63
41
 
64
42
 
65
43
  ```
44
+
45
+
46
+
47
+ 自分で作成したdf関数の中にexchange[0]を追加したいです。

7

補足4

2018/05/14 13:29

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  exchange = [
12
12
 
13
- ccxt.hogebit({
13
+ hogebit({
14
14
 
15
15
  'apiKey': 'hoge',
16
16
 
@@ -18,7 +18,7 @@
18
18
 
19
19
  }),
20
20
 
21
- ccxt.hogeif({
21
+ hogeif({
22
22
 
23
23
  'apiKey': 'hoge',
24
24
 
@@ -26,7 +26,7 @@
26
26
 
27
27
  }),
28
28
 
29
- ccxt.hogebank({
29
+ hogebank({
30
30
 
31
31
  'apiKey': 'hoge',
32
32
 
@@ -40,49 +40,7 @@
40
40
 
41
41
  def order_process(arbitrage_decision,best_ask_price,set_ask_volume,target_currency):
42
42
 
43
-
44
-
45
- ///////////////////////////////////現在ダミーでここにもexchangeを追加しています。
46
-
47
- exchange = [
48
-
49
- ccxt.hogebit({
50
-
51
- 'apiKey': 'hoge',
52
-
53
- 'secret': 'hoge',
54
-
55
- }),
56
-
57
- ccxt.hogeif({
58
-
59
- 'apiKey': 'hoge',
60
-
61
- 'secret': 'hoge',
62
-
63
- }),
64
-
65
- ccxt.hogebank({
66
-
67
- 'apiKey': 'hoge',
68
-
69
- 'secret': 'hoge',
70
-
71
- })
72
-
73
- ]
74
-
75
-
76
-
77
- ask_exchange = "hoge"
78
-
79
- set_ask_volume = 0.001
80
-
81
- best_ask_price = 300000
82
-
83
-
84
-
85
- limit_ordered_info = exchange[0].create_order( >>>>>>>>>>>>>>>>>>>>>>>>>[0]を追加して問題解決
43
+ limit_ordered_info = exchange[0].create_order( >>>>>>>>>>>>>>>>>>>>>>>>>[0]を引数として追加したい。
86
44
 
87
45
  symbol= target_currency,
88
46
 
@@ -100,14 +58,8 @@
100
58
 
101
59
  return limit_ordered_info
102
60
 
103
-
104
-
105
61
  order_process(arbitrage_decision,best_ask_price,set_ask_volume,target_currency)
106
62
 
107
63
 
108
64
 
109
65
  ```
110
-
111
-
112
-
113
- ダミー文のexchange(df内で宣言しているもの)を削除したいです。

6

補足3

2018/05/14 13:21

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -2,9 +2,75 @@
2
2
 
3
3
  ```ここに言語を入力
4
4
 
5
+
6
+
7
+ MAIN処理
8
+
9
+
10
+
11
+ exchange = [
12
+
13
+ ccxt.hogebit({
14
+
15
+ 'apiKey': 'hoge',
16
+
17
+ 'secret': 'hoge',
18
+
19
+ }),
20
+
21
+ ccxt.hogeif({
22
+
23
+ 'apiKey': 'hoge',
24
+
25
+ 'secret': 'hoge',
26
+
27
+ }),
28
+
29
+ ccxt.hogebank({
30
+
31
+ 'apiKey': 'hoge',
32
+
33
+ 'secret': 'hoge',
34
+
35
+ })
36
+
37
+ ]
38
+
39
+
40
+
5
41
  def order_process(arbitrage_decision,best_ask_price,set_ask_volume,target_currency):
6
42
 
43
+
44
+
45
+ ///////////////////////////////////現在ダミーでここにもexchangeを追加しています。
46
+
47
+ exchange = [
48
+
7
- print(arbitrage_decision)
49
+ ccxt.hogebit({
50
+
51
+ 'apiKey': 'hoge',
52
+
53
+ 'secret': 'hoge',
54
+
55
+ }),
56
+
57
+ ccxt.hogeif({
58
+
59
+ 'apiKey': 'hoge',
60
+
61
+ 'secret': 'hoge',
62
+
63
+ }),
64
+
65
+ ccxt.hogebank({
66
+
67
+ 'apiKey': 'hoge',
68
+
69
+ 'secret': 'hoge',
70
+
71
+ })
72
+
73
+ ]
8
74
 
9
75
 
10
76
 
@@ -16,7 +82,7 @@
16
82
 
17
83
 
18
84
 
19
- limit_ordered_info = exchange.create_order(
85
+ limit_ordered_info = exchange[0].create_order( >>>>>>>>>>>>>>>>>>>>>>>>>[0]を追加して問題解決
20
86
 
21
87
  symbol= target_currency,
22
88
 
@@ -44,24 +110,4 @@
44
110
 
45
111
 
46
112
 
47
- 自分で作成した関数ではなく外(メイン処理)では
48
-
49
- limit_ordered_info = exchange.create_order( は処理を正常確認していす。
113
+ ダミー文のexchangedf内で宣言しているもの)を削除したいです。
50
-
51
-
52
-
53
- 自分で宣言した dfの中だと limit_ordered_info = exchange.create_order(
54
-
55
- でエラーが出ます。
56
-
57
-
58
-
59
- **エラー箇所**
60
-
61
- limit_ordered_info = exchange.create_order(
62
-
63
-
64
-
65
- **該当エラー内容**
66
-
67
- AttributeError: object has no attribute

5

補足2

2018/05/14 13:09

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -44,4 +44,24 @@
44
44
 
45
45
 
46
46
 
47
+ 自分で作成した関数ではなく外(メイン処理)では
48
+
49
+ limit_ordered_info = exchange.create_order( は処理を正常確認しています。
50
+
51
+
52
+
53
+ 自分で宣言した dfの中だと limit_ordered_info = exchange.create_order(
54
+
55
+ でエラーが出ます。
56
+
57
+
58
+
59
+ **エラー箇所**
60
+
61
+ limit_ordered_info = exchange.create_order(
62
+
63
+
64
+
65
+ **該当エラー内容**
66
+
47
- 以下でAttributeError: object has no attribute エラーが出ている状況です。
67
+ AttributeError: object has no attribute

4

成形

2018/05/14 12:45

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
 
10
10
 
11
- ask_exchange = "bitflyer"
11
+ ask_exchange = "hoge"
12
12
 
13
13
  set_ask_volume = 0.001
14
14
 
@@ -16,27 +16,21 @@
16
16
 
17
17
 
18
18
 
19
- if ask_exchange == "bitflyer":
19
+ limit_ordered_info = exchange.create_order(
20
20
 
21
- print("取引所はbitflyerです。")
21
+ symbol= target_currency,
22
22
 
23
- limit_ordered_info = exchange.create_order(
23
+ type='limit',
24
24
 
25
- symbol= target_currency,
25
+ side='buy',
26
26
 
27
- type='limit',
27
+ amount= set_ask_volume,
28
28
 
29
- side='buy',
29
+ price= best_ask_price
30
30
 
31
- amount= set_ask_volume,
31
+ )
32
32
 
33
- price= best_ask_price
34
-
35
- )
36
-
37
- print(json.dumps(limit_ordered_info, indent=True))
33
+ print(json.dumps(limit_ordered_info, indent=True))
38
-
39
-
40
34
 
41
35
  return limit_ordered_info
42
36
 
@@ -44,6 +38,8 @@
44
38
 
45
39
  order_process(arbitrage_decision,best_ask_price,set_ask_volume,target_currency)
46
40
 
41
+
42
+
47
43
  ```
48
44
 
49
45
 

3

補足

2018/05/14 12:43

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -1,9 +1,51 @@
1
1
  お世話になります。python初心者です。
2
+
3
+ ```ここに言語を入力
4
+
5
+ def order_process(arbitrage_decision,best_ask_price,set_ask_volume,target_currency):
6
+
7
+ print(arbitrage_decision)
2
8
 
3
9
 
4
10
 
5
- ![![イメージ説明](ccc2bfbf95dba732799cfbd236814040.jpeg)](4ddec8a419f485de409432cc7758b133.jpeg)
11
+ ask_exchange = "bitflyer"
12
+
13
+ set_ask_volume = 0.001
14
+
15
+ best_ask_price = 300000
6
16
 
7
17
 
8
18
 
19
+ if ask_exchange == "bitflyer":
20
+
21
+ print("取引所はbitflyerです。")
22
+
23
+ limit_ordered_info = exchange.create_order(
24
+
25
+ symbol= target_currency,
26
+
27
+ type='limit',
28
+
9
- 以下でエラーが出ます。
29
+ side='buy',
30
+
31
+ amount= set_ask_volume,
32
+
33
+ price= best_ask_price
34
+
35
+ )
36
+
37
+ print(json.dumps(limit_ordered_info, indent=True))
38
+
39
+
40
+
41
+ return limit_ordered_info
42
+
43
+
44
+
45
+ order_process(arbitrage_decision,best_ask_price,set_ask_volume,target_currency)
46
+
47
+ ```
48
+
49
+
50
+
51
+ 以下でAttributeError: object has no attribute エラーが出ている状況です。

2

画像追加

2018/05/14 12:38

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -2,92 +2,8 @@
2
2
 
3
3
 
4
4
 
5
- 以下のようにorder_processという関数を作成しました。
5
+ ![![イメージ説明](ccc2bfbf95dba732799cfbd236814040.jpeg)](4ddec8a419f485de409432cc7758b133.jpeg)
6
-
7
- ```ここに言語を入力
8
-
9
- test_importというimportの中には
10
-
11
-           xxx.cre_order(
12
-
13
- a = 1,
14
-
15
- b = 2,
16
-
17
- c = 3,
18
-
19
- d = 4
20
-
21
- )
22
-
23
- ```
24
-
25
- というimportの中の関数を使える事ができます。
26
6
 
27
7
 
28
8
 
29
- 以下のように自分で作成した関数の def の中で xxx.cre_order関数を利用する為には
30
-
31
- def の中も test_import をimportしなければいけないのでしょうか?
32
-
33
-
34
-
35
- ```ここに言語を入力
9
+ 以下でエラーが出ます。
36
-
37
- import test_import
38
-
39
- import json
40
-
41
- import datetime
42
-
43
-
44
-
45
- a = 1
46
-
47
- b = 2
48
-
49
- c = 3
50
-
51
- d = 4
52
-
53
- e = ""
54
-
55
-
56
-
57
- e = xxx.cre_order(
58
-
59
- a = 1,
60
-
61
- b = 2,
62
-
63
- c = 3,
64
-
65
- d = 4
66
-
67
- )
68
-
69
-
70
-
71
- def order_process(a,b,c,d):
72
-
73
- >>>>>>>>>>>>>>>>>>>>>>>>>>ここにtest_importを記載すれば xxx.cre_order が利用できるのでしょうか?
74
-
75
-
76
-
77
- e = xxx.cre_order(
78
-
79
- a = 1,
80
-
81
- b = 2,
82
-
83
- c = 3,
84
-
85
- d = 4
86
-
87
- )
88
-
89
-
90
-
91
- print(a)
92
-
93
- ```

1

表記

2018/05/14 12:32

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
 
28
28
 
29
- 以下のように def の中で xxx.cre_order関数を利用する為には
29
+ 以下のように自分で作成した関数の def の中で xxx.cre_order関数を利用する為には
30
30
 
31
31
  def の中も test_import をimportしなければいけないのでしょうか?
32
32