MCPcopy
hub / github.com/ccxt/ccxt / featureValueByType

Method featureValueByType

java/lib/src/main/java/io/github/ccxt/Exchange.java:5847–5947  ·  view source on GitHub ↗
(Object marketType, Object subType, Object... optionalArgs)

Source from the content-addressed store, hash-verified

5845 }
5846
5847 public Object featureValueByType(Object marketType, Object subType, Object... optionalArgs)
5848 {
5849 /**
5850 * @method
5851 * @name exchange#featureValueByType
5852 * @description this method is a very deterministic to help users to know what feature is supported by the exchange
5853 * @param {string} [marketType] supported only: "spot", "swap", "future"
5854 * @param {string} [subType] supported only: "linear", "inverse"
5855 * @param {string} [methodName] view currently supported methods: https://docs.ccxt.com/README?id=features
5856 * @param {string} [paramName] unified param value (check docs for supported param names)
5857 * @param {object} [defaultValue] return default value if no result found
5858 * @returns {object} returns feature value
5859 */
5860 // if exchange does not yet have features manually implemented
5861 Object methodName = Helpers.getArg(optionalArgs, 0, null);
5862 Object paramName = Helpers.getArg(optionalArgs, 1, null);
5863 Object defaultValue = Helpers.getArg(optionalArgs, 2, null);
5864 if (Helpers.isTrue(Helpers.isEqual(this.features, null)))
5865 {
5866 return defaultValue;
5867 }
5868 if (Helpers.isTrue(Helpers.isEqual(marketType, null)))
5869 {
5870 return defaultValue; // marketType is required
5871 }
5872 // if marketType (e.g. 'option') does not exist in features
5873 if (!Helpers.isTrue((Helpers.inOp(this.features, marketType))))
5874 {
5875 return defaultValue; // unsupported marketType, check "exchange.features" for details
5876 }
5877 // if marketType dict undefined
5878 if (Helpers.isTrue(Helpers.isEqual(Helpers.GetValue(this.features, marketType), null)))
5879 {
5880 return defaultValue;
5881 }
5882 Object methodsContainer = Helpers.GetValue(this.features, marketType);
5883 if (Helpers.isTrue(Helpers.isEqual(subType, null)))
5884 {
5885 if (Helpers.isTrue(!Helpers.isEqual(marketType, "spot")))
5886 {
5887 return defaultValue; // subType is required for non-spot markets
5888 }
5889 } else
5890 {
5891 if (!Helpers.isTrue((Helpers.inOp(Helpers.GetValue(this.features, marketType), subType))))
5892 {
5893 return defaultValue; // unsupported subType, check "exchange.features" for details
5894 }
5895 // if subType dict undefined
5896 if (Helpers.isTrue(Helpers.isEqual(Helpers.GetValue(Helpers.GetValue(this.features, marketType), subType), null)))
5897 {
5898 return defaultValue;
5899 }
5900 methodsContainer = Helpers.GetValue(Helpers.GetValue(this.features, marketType), subType);
5901 }
5902 // if user wanted only marketType and didn't provide methodName, eg: featureIsSupported('spot')
5903 if (Helpers.isTrue(Helpers.isEqual(methodName, null)))
5904 {

Callers 1

featureValueMethod · 0.95

Calls 8

getArgMethod · 0.95
isTrueMethod · 0.95
isEqualMethod · 0.95
inOpMethod · 0.95
GetValueMethod · 0.95
splitMethod · 0.95
safeStringMethod · 0.95
safeDictMethod · 0.95

Tested by

no test coverage detected