添加 wiki.go
commit
56fc2fb336
571
wiki.go.md
Normal file
571
wiki.go.md
Normal file
@ -0,0 +1,571 @@
|
|||||||
|
### 类: `Exchange`
|
||||||
|
|
||||||
|
**描述:**
|
||||||
|
`Exchange` 类是用于与加密货币交易所进行交互的基础类。它包含了交易所的各种属性和方法,用于处理市场数据、货币信息、API调用等。
|
||||||
|
|
||||||
|
### 接口: `IDerivedExchange`
|
||||||
|
|
||||||
|
**描述:**
|
||||||
|
`IDerivedExchange` 是一个接口,定义了交易所需要实现的方法,例如 `FetchCurrencies` 和 `FetchMarkets`。
|
||||||
|
|
||||||
|
### 接口: `IExchange`
|
||||||
|
|
||||||
|
**描述:**
|
||||||
|
`IExchange` 是一个接口,定义了交易所的基本操作方法。
|
||||||
|
|
||||||
|
### 接口: `MarketInterface`
|
||||||
|
|
||||||
|
**描述:**
|
||||||
|
`MarketInterface` 是一个接口,定义了市场相关的操作方法。
|
||||||
|
|
||||||
|
### 接口: `Currency`
|
||||||
|
|
||||||
|
**描述:**
|
||||||
|
`Currency` 是一个接口,定义了货币相关的操作方法。
|
||||||
|
|
||||||
|
### 接口: `ArrayCache`
|
||||||
|
|
||||||
|
**描述:**
|
||||||
|
`ArrayCache` 是一个接口,定义了一个将对象转换为数组的方法。
|
||||||
|
|
||||||
|
### 接口: `ErrorType`
|
||||||
|
|
||||||
|
**描述:**
|
||||||
|
`ErrorType` 是一个字符串类型的别名,用于表示错误类型。
|
||||||
|
|
||||||
|
### 接口: `Error`
|
||||||
|
|
||||||
|
**描述:**
|
||||||
|
`Error` 是一个结构体,实现了 `error` 接口,用于表示错误信息。
|
||||||
|
|
||||||
|
### 方法签名及参数说明
|
||||||
|
|
||||||
|
#### 方法: `InitParent`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) InitParent(userConfig map[string]interface{}, exchangeConfig map[string]interface{}, itf interface{})
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `userConfig`: 用户配置的映射。
|
||||||
|
- `exchangeConfig`: 交易所配置的映射。
|
||||||
|
- `itf`: 交易所接口实例。
|
||||||
|
|
||||||
|
#### 方法: `Init`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) Init(userConfig map[string]interface{})
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `userConfig`: 用户配置的映射。
|
||||||
|
|
||||||
|
#### 方法: `NewExchange`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func NewExchange() IExchange
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- 无参数。
|
||||||
|
|
||||||
|
#### 方法: `WarmUpCache`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) WarmUpCache()
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- 无参数。
|
||||||
|
|
||||||
|
#### 方法: `InitThrottler`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) InitThrottler()
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- 无参数。
|
||||||
|
|
||||||
|
#### 方法: `LoadMarkets`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) LoadMarkets(params ...interface{}) <-chan interface{}
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `params`: 可选参数列表。
|
||||||
|
|
||||||
|
#### 方法: `Throttle`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) Throttle(cost interface{}) <-chan interface{}
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `cost`: 调用成本。
|
||||||
|
|
||||||
|
#### 方法: `FetchMarkets`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) FetchMarkets(optionalArgs ...interface{}) <-chan interface{}
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `optionalArgs`: 可选参数列表。
|
||||||
|
|
||||||
|
#### 方法: `FetchCurrencies`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) FetchCurrencies(optionalArgs ...interface{}) <-chan interface{}
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `optionalArgs`: 可选参数列表。
|
||||||
|
|
||||||
|
#### 方法: `Sleep`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) Sleep(milliseconds interface{}) <-chan bool
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `milliseconds`: 睡眠时间(毫秒)。
|
||||||
|
|
||||||
|
#### 方法: `Unique`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func Unique(obj interface{}) []string
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `obj`: 对象,期望为字符串切片。
|
||||||
|
|
||||||
|
#### 方法: `Log`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) Log(args ...interface{})
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `args`: 日志参数列表。
|
||||||
|
|
||||||
|
#### 方法: `callEndpoint`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) callEndpoint(endpoint2 interface{}, parameters interface{}) <-chan interface{}
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `endpoint2`: API 端点。
|
||||||
|
- `parameters`: 请求参数。
|
||||||
|
|
||||||
|
#### 方法: `NewError`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func NewError(errType interface{}, message ...interface{}) error
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `errType`: 错误类型。
|
||||||
|
- `message`: 错误消息(可选)。
|
||||||
|
|
||||||
|
#### 方法: `Exception`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func Exception(v ...interface{}) error
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `v`: 异常信息。
|
||||||
|
|
||||||
|
#### 方法: `IsError`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func IsError(res interface{}) bool
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `res`: 响应结果。
|
||||||
|
|
||||||
|
#### 方法: `CreateReturnError`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func CreateReturnError(res interface{}) error
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `res`: 响应结果。
|
||||||
|
|
||||||
|
#### 方法: `ToSafeFloat`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func ToSafeFloat(v interface{}) (float64, error)
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `v`: 需要转换为浮点数的值。
|
||||||
|
|
||||||
|
#### 方法: `Json`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) Json(object interface{}) interface{}
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `object`: 需要转换为 JSON 字符串的对象。
|
||||||
|
|
||||||
|
#### 方法: `ParseNumber`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) ParseNumber(v interface{}, a ...interface{}) interface{}
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `v`: 需要解析的数值。
|
||||||
|
- `a`: 默认值(可选)。
|
||||||
|
|
||||||
|
#### 方法: `ValueIsDefined`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) ValueIsDefined(v interface{}) bool
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `v`: 需要检查的值。
|
||||||
|
|
||||||
|
#### 方法: `callDynamically`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) callDynamically(name2 interface{}, args ...interface{}) <-chan interface{}
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `name2`: 方法名称。
|
||||||
|
- `args`: 方法参数列表。
|
||||||
|
|
||||||
|
#### 方法: `Clone`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) Clone(object interface{}) interface{}
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `object`: 需要克隆的对象。
|
||||||
|
|
||||||
|
#### 方法: `DeepCopy`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) DeepCopy(value reflect.Value) reflect.Value
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `value`: 需要深拷贝的反射值。
|
||||||
|
|
||||||
|
#### 方法: `ArraySlice`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) ArraySlice(array interface{}, first interface{}, second ...interface{}) interface{}
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `array`: 数组或切片。
|
||||||
|
- `first`: 起始索引。
|
||||||
|
- `second`: 结束索引(可选)。
|
||||||
|
|
||||||
|
#### 方法: `sliceToInterface`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) sliceToInterface(value reflect.Value) []interface{}
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `value`: 需要转换为接口切片的反射值。
|
||||||
|
|
||||||
|
#### 方法: `ParseTimeframe`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) ParseTimeframe(timeframe interface{}) interface{}
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `timeframe`: 时间框架字符串。
|
||||||
|
|
||||||
|
#### 方法: `Totp`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func Totp(secret interface{}) string
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `secret`: 密钥。
|
||||||
|
|
||||||
|
#### 方法: `ParseJson`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) ParseJson(input interface{}) interface{}
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `input`: 需要解析的 JSON 输入。
|
||||||
|
|
||||||
|
#### 方法: `transformApiNew`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) transformApiNew(api Dict, paths ...string)
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `api`: API 映射。
|
||||||
|
- `paths`: 路径列表(可选)。
|
||||||
|
|
||||||
|
#### 方法: `isHttpMethod`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func isHttpMethod(key string) bool
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `key`: HTTP 方法名称。
|
||||||
|
|
||||||
|
#### 方法: `parseCost`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func parseCost(costStr string) float64
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `costStr`: 成本字符串。
|
||||||
|
|
||||||
|
#### 方法: `CheckRequiredDependencies`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) CheckRequiredDependencies()
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- 无参数。
|
||||||
|
|
||||||
|
#### 方法: `FixStringifiedJsonMembers`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) FixStringifiedJsonMembers(a interface{}) string
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `a`: 字符串化的 JSON 成员。
|
||||||
|
|
||||||
|
#### 方法: `IsEmpty`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) IsEmpty(a interface{}) bool
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `a`: 需要检查的对象。
|
||||||
|
|
||||||
|
#### 方法: `CallInternal`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) CallInternal(name2 string, args ...interface{}) <-chan interface{}
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `name2`: 方法名称。
|
||||||
|
- `args`: 方法参数列表。
|
||||||
|
|
||||||
|
#### 方法: `callInternal`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) callInternal(name2 string, args ...interface{}) <-chan interface{}
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `name2`: 方法名称。
|
||||||
|
- `args`: 方法参数列表。
|
||||||
|
|
||||||
|
#### 方法: `RandomBytes`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) RandomBytes(length interface{}) string
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `length`: 随机字节长度。
|
||||||
|
|
||||||
|
#### 方法: `IsJsonEncodedObject`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) IsJsonEncodedObject(str interface{}) bool
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `str`: 字符串。
|
||||||
|
|
||||||
|
#### 方法: `StringToCharsArray`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) StringToCharsArray(value interface{}) []string
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `value`: 字符串。
|
||||||
|
|
||||||
|
#### 方法: `GetMarket`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) GetMarket(symbol string) MarketInterface
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `symbol`: 市场符号。
|
||||||
|
|
||||||
|
#### 方法: `GetMarketsList`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) GetMarketsList() []MarketInterface
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- 无参数。
|
||||||
|
|
||||||
|
#### 方法: `GetCurrency`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) GetCurrency(currency string) Currency
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `currency`: 货币符号。
|
||||||
|
|
||||||
|
#### 方法: `GetCurrenciesList`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) GetCurrenciesList() []Currency
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- 无参数。
|
||||||
|
|
||||||
|
#### 方法: `SetProperty`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) SetProperty(obj interface{}, property interface{}, defaultValue interface{})
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `obj`: 对象。
|
||||||
|
- `property`: 属性名称。
|
||||||
|
- `defaultValue`: 默认值。
|
||||||
|
|
||||||
|
#### 方法: `GetProperty`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) GetProperty(obj interface{}, property interface{}) interface{}
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `obj`: 对象。
|
||||||
|
- `property`: 属性名称。
|
||||||
|
|
||||||
|
#### 方法: `RetrieveStarkAccount`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) RetrieveStarkAccount(sig interface{}, account interface{}, hash interface{}) interface{}
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `sig`: 签名。
|
||||||
|
- `account`: 账户。
|
||||||
|
- `hash`: 哈希值。
|
||||||
|
|
||||||
|
#### 方法: `StarknetEncodeStructuredData`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) StarknetEncodeStructuredData(a interface{}, b interface{}, c interface{}, d interface{}) interface{}
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `a`: 参数 a。
|
||||||
|
- `b`: 参数 b。
|
||||||
|
- `c`: 参数 c。
|
||||||
|
- `d`: 参数 d。
|
||||||
|
|
||||||
|
#### 方法: `StarknetSign`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) StarknetSign(a interface{}, b interface{}) interface{}
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `a`: 参数 a。
|
||||||
|
- `b`: 参数 b。
|
||||||
|
|
||||||
|
#### 方法: `ExtendExchangeOptions`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) ExtendExchangeOptions(options2 interface{})
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- `options2`: 选项映射。
|
||||||
|
|
||||||
|
#### 方法: `UpdateProxySettings`
|
||||||
|
|
||||||
|
**签名:**
|
||||||
|
```go
|
||||||
|
func (this *Exchange) UpdateProxySettings()
|
||||||
|
```
|
||||||
|
|
||||||
|
**参数说明:**
|
||||||
|
- 无参数。
|
Loading…
x
Reference in New Issue
Block a user