# haasomeapi.apis.MarketDataApi模塊
## 功能
```
class haasomeapi.apis.MarketDataApi.MarketDataApi(connectionstring:str,privatekey:str )
Bases: haasomeapi.apis.ApiBase.ApiBase
```
市場數據API類,提供對市場數據端點的訪問
| 參數 |類型 |說明|
|---|---|---|
| connectionstring | str | Connection String Formatted Ex. [http://127.0.0.1:9000](http://127.0.0.1:9000/) |
|privatekey |str|Private Key Set In The Haas Settings|
```
get_all_price_markets()
```
返回所有市場
| 返回 |
|---|
| [HaasomeClientResponse](http://www.hmoore.net/zbb1025/gggg/780189) |
| In .result List[[Market](http://www.hmoore.net/zbb1025/xxxx/780573)] of markets|
```
add_stop_order(accountguid: str, name: str, primarycoin: str, secondarycoin: str, direction: haasomeapi.enums.EnumOrderType.EnumOrderType, executingtemplateguid: str, triggerprice: float, executionprice: float, amount: float, startorderonactivation: bool, startorderprice: float, starttemplateguid: str, activate: bool)
get_all_price_sources()
```
返回所有可用的價格來源
| 返回 |
|---|
| [HaasomeClientResponse](http://www.hmoore.net/zbb1025/gggg/780189) |
| In .result List[str] of all the prices sources|
```
get_enabled_price_sources()
```
返回所有啟用的價格來源
| 返回 |
|---|
| [HaasomeClientResponse](http://www.hmoore.net/zbb1025/gggg/780189) |
|In .result List[str] of all the enabled sources|
```
get_history(priceource:haasomeapi.enums.EnumPriceSource.EnumPriceSource,primarycoin :str,secondarycoin:str,contractname:str,interval:int,depth:int )
```
從價格服務器獲取價格歷史記錄
| 參數 |類型 |說明|
|---|---|---|
| priceource| [EnumPriceSource](http://www.hmoore.net/zbb1025/cccc/780202) |價格來源(交易所)來獲取股票代碼
|primarycoin |str |基礎貨幣 Ex. 如果BNB / BTC然后將其設置為BNB|
| secondarycoin|str |計價貨幣 Ex. 如果BNB / BTC然后將其設置為BTC|
|**contractname** |str |合同名稱(可選)|
|**interval** |int |蠟燭間隔值Ex。1,2,3,5,15,30等(分鐘)|
|**depth** |int |要獲得的深度或蠟燭數量|
| 返回 |
|---|
| [HaasomeClientResponse](http://www.hmoore.net/zbb1025/gggg/780189) |
| In .result List[[Price Tick ](http://www.hmoore.net/zbb1025/xxxx/780573)]: List of Price Tick objects|
```
get_history_from_market(market: haasomeapi.dataobjects.marketdata.Market.Market,interval:int,depth:int )
```
使用市場對象從價格服務器獲取價格歷史
| 參數 |類型 |說明|
|---|---|---|
|**market** | [Market](http://www.hmoore.net/zbb1025/xxxx/780573)|Market object to use|
|**interval** |int |蠟燭間隔值Ex。1,2,3,5,15,30等(分鐘)|
|**depth** |int |要獲得的深度或蠟燭數量|
| 返回 |
|---|
| [HaasomeClientResponse](http://www.hmoore.net/zbb1025/gggg/780189) |
| In .result List[Price Tick ](http://www.hmoore.net/zbb1025/xxxx/780573)]: List of Price Tick objects|
```
get_last_trades(priceource:haasomeapi.enums.EnumPriceSource.EnumPriceSource,primarycoin :str,secondarycoin:str,contractname:str )
```
返回指定市場的交易歷史
| 參數 |類型 |說明|
|---|---|---|
| priceource| [EnumPriceSource](http://www.hmoore.net/zbb1025/cccc/780202) |價格來源(交易所)來獲取股票代碼
|primarycoin |str |基礎貨幣 Ex. 如果BNB / BTC然后將其設置為BNB|
| secondarycoin|str |計價貨幣 Ex. 如果BNB / BTC然后將其設置為BTC|
|**contractname** |str |合同名稱(可選)|
| 返回 |
|---|
| [HaasomeClientResponse](http://www.hmoore.net/zbb1025/gggg/780189) |
| In .result [Trade Container](http://www.hmoore.net/zbb1025/xxxx/780573): Trade Container object
```
get_last_trades_from_market(market: haasomeapi.dataobjects.marketdata.Market.Market )
```
使用市場對象返回指定市場的交易歷史
| 參數 |類型 |說明|
|---|---|---|
|**market** | [Market](http://www.hmoore.net/zbb1025/xxxx/780573)|Market object to use|
| 返回 |
|---|
| [HaasomeClientResponse](http://www.hmoore.net/zbb1025/gggg/780189) |
| In .result [Trade Container](http://www.hmoore.net/zbb1025/xxxx/780573): Trade Container object
```
get_minute_price_ticker(priceource:haasomeapi.enums.EnumPriceSource.EnumPriceSource,primarycoin :str,secondarycoin:str,contractname:str )
```
返回分鐘價格代碼
| 參數 |類型 |說明|
|---|---|---|
| priceource| [EnumPriceSource](http://www.hmoore.net/zbb1025/cccc/780202) |價格來源(交易所)來獲取股票代碼
|primarycoin |str |基礎貨幣 Ex. 如果BNB / BTC然后將其設置為BNB|
| secondarycoin|str |計價貨幣 Ex. 如果BNB / BTC然后將其設置為BTC|
|**contractname** |str |合同名稱(可選)|
| 返回 |
|---|
| [HaasomeClientResponse](http://www.hmoore.net/zbb1025/gggg/780189) |
| In .result [ Price Tick](http://www.hmoore.net/zbb1025/xxxx/780573): Price Tick object
```
get_minute_price_ticker_from_market(market: haasomeapi.dataobjects.marketdata.Market.Market )
```
使用市場對象返回分鐘價格代碼
| 參數 |類型 |說明|
|---|---|---|
|**market** | [Market](http://www.hmoore.net/zbb1025/xxxx/780573)|Market object to use|
| 返回 |
|---|
| [HaasomeClientResponse](http://www.hmoore.net/zbb1025/gggg/780189) |
| In .result [ Price Tick](http://www.hmoore.net/zbb1025/xxxx/780573): Price Tick object
```
get_order_book(priceource:haasomeapi.enums.EnumPriceSource.EnumPriceSource,primarycoin :str,secondarycoin:str,contractname:str )
```
返回指定市場的當前訂單
| 參數 |類型 |說明|
|---|---|---|
| priceource| [EnumPriceSource](http://www.hmoore.net/zbb1025/cccc/780202) |價格來源(交易所)來獲取股票代碼
|primarycoin |str |基礎貨幣 Ex. 如果BNB / BTC然后將其設置為BNB|
| secondarycoin|str |計價貨幣 Ex. 如果BNB / BTC然后將其設置為BTC|
|**contractname** |str |合同名稱(可選)|
| 返回 |
|---|
| [HaasomeClientResponse](http://www.hmoore.net/zbb1025/gggg/780189) |
| In .result [Orderbook]((http://www.hmoore.net/zbb1025/xxxx/780573)): Orderbook object
```
get_order_book_from_market(market: haasomeapi.dataobjects.marketdata.Market.Market )
```
使用市場對象返回指定市場的當前訂單
| 參數 |類型 |說明|
|---|---|---|
|**market** | [Market](http://www.hmoore.net/zbb1025/xxxx/780573)|Market object to use|
| 返回 |
|---|
| [HaasomeClientResponse](http://www.hmoore.net/zbb1025/gggg/780189) |
| In .result [Orderbook](http://www.hmoore.net/zbb1025/xxxx/780573): Orderbook object
```
get_price_markets(priceource:haasomeapi.enums.EnumPriceSource.EnumPriceSource )
```
返回指定價格來源的市場
| 參數 |類型 |說明|
|---|---|---|
| priceource| [EnumPriceSource](http://www.hmoore.net/zbb1025/cccc/780202)|價格來源(交換)
| 返回 |
|---|
| [HaasomeClientResponse](http://www.hmoore.net/zbb1025/gggg/780189) |
| In .result List[[Market](http://www.hmoore.net/zbb1025/xxxx/780573)] of markets
```
get_price_ticker(priceource:haasomeapi.enums.EnumPriceSource.EnumPriceSource,primarycoin :str,secondarycoin:str,contractname:str )
```
返回當前價格刻度對象
| 參數 |類型 |說明|
|---|---|---|
| priceource| [EnumPriceSource](http://www.hmoore.net/zbb1025/cccc/780202) |價格來源(交易所)來獲取股票代碼
|primarycoin |str |基礎貨幣 Ex. 如果BNB / BTC然后將其設置為BNB|
| secondarycoin|str |計價貨幣 Ex. 如果BNB / BTC然后將其設置為BTC|
|**contractname** |str |合同名稱(可選)|
| 返回 |
|---|
| [HaasomeClientResponse](http://www.hmoore.net/zbb1025/gggg/780189) |
| In .result [Price Tick ](http://www.hmoore.net/zbb1025/xxxx/780573): Price Tick object
```
get_price_ticker_from_market(market: haasomeapi.dataobjects.marketdata.Market.Market )
```
從市場對象返回當前價格刻度對象
| 參數 |類型 |說明|
|---|---|---|
|**market** | [Market](http://www.hmoore.net/zbb1025/xxxx/780573)|Market object to use|
| 返回 |
|---|
| [HaasomeClientResponse](http://www.hmoore.net/zbb1025/gggg/780189) |
| In .result [Price Tick ](http://www.hmoore.net/zbb1025/xxxx/780573): Price Tick object