binance-exports 0.1.1.0 → 0.1.2.0
raw patch · 6 files changed
+35/−18 lines, 6 filesdep ~tasty-hedgehogPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: tasty-hedgehog
API changes (from Hackage documentation)
Files
- CHANGELOG.md +8/−0
- README.md +1/−0
- binance-exports.cabal +4/−4
- src/Console/Binance/Exports/Main.hs +7/−7
- src/Web/Binance.hs +14/−6
- tests/Spec.hs +1/−1
CHANGELOG.md view
@@ -4,6 +4,14 @@ ## master +## v0.1.2.0++* Fix backwards incompatible dependency breakages.+* Fix a bug causing all options in config files to be+ required. They are all now optional as originally+ intended.++ ## v0.1.1.0 * Expand documentation printed out with the `--help` flag.
README.md view
@@ -22,6 +22,7 @@ TODO: * Switch between Binance & Binance US APIs+* Include Fiat/Crypto Deposits & Withdrawals [get-stack]: https://docs.haskellstack.org/en/stable/README/
binance-exports.cabal view
@@ -1,12 +1,12 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4.+-- This file has been generated from package.yaml by hpack version 0.35.2. -- -- see: https://github.com/sol/hpack name: binance-exports-version: 0.1.1.0-synopsis: Generate CSV Exports to your Binance Trade History.+version: 0.1.2.0+synopsis: Generate CSV Exports of your Binance Trade History. description: @binance-exports@ is a CLI program that queries the Binance.us API for your Trade History & exports all trades to a CSV file. .@@ -131,6 +131,6 @@ , binance-exports , hedgehog , tasty- , tasty-hedgehog+ , tasty-hedgehog >=1.2 , tasty-hunit default-language: Haskell2010
src/Console/Binance/Exports/Main.hs view
@@ -15,7 +15,7 @@ import Control.Exception.Safe ( try ) import Control.Monad ( (<=<) ) import Control.Monad.IO.Class ( liftIO )-import Data.Aeson ( (.:)+import Data.Aeson ( (.:?) , FromJSON(..) , withObject )@@ -168,14 +168,14 @@ instance FromJSON ConfigFile where parseJSON = withObject "ConfigFile" $ \o -> do- cfgApiKey <- o .: "api-key"- cfgApiSecret <- o .: "api-secret"- cfgSymbols <- o .: "symbols"+ cfgApiKey <- o .:? "api-key"+ cfgApiSecret <- o .:? "api-secret"+ cfgSymbols <- o .:? "symbols" return ConfigFile { .. } -- | Attempt to read a 'ConfigFile' from--- @$XDG_CONFIG_HOME/binance-exports/config.yaml@. Print any parsing errors--- to 'stderr'.+-- @$XDG_CONFIG_HOME\/binance-exports\/config.yaml@. Print any parsing+-- errors to 'stderr'. loadConfigFile :: IO ConfigFile loadConfigFile = do configPath <- getUserConfigFile "binance-exports" "config.yaml"@@ -291,7 +291,7 @@ CONFIGURATION FILE You can also set some program options in a YAML file. We attempt to parse-a configuration file at `$XDG_CONFIG_HOME/binance-exports.yaml`. It+a configuration file at `$XDG_CONFIG_HOME/binance-exports/config.yaml`. It supports the following top-level keys: - `api-key`: (string) Your Binance API key
src/Web/Binance.hs view
@@ -28,8 +28,8 @@ , throw , try )-import Control.Monad.Reader ( (<=<)- , MonadIO+import Control.Monad ( (<=<) )+import Control.Monad.Reader ( MonadIO , MonadReader , ReaderT , ask@@ -285,8 +285,8 @@ -- UTILS --- | Run a request for a SIGNED endpoint by inserting the signature before--- making the request.+-- | Run a request for a @SIGNED@ endpoint by inserting the signature into+-- the query string before making the request. runSignedRequest :: ( MonadHttp m , HttpMethod method@@ -317,8 +317,16 @@ RequestBodyBS bs -> bs _ -> "" --- | Generate a HMAC SHA256 signature for a SIGNED api request.-mkSignature :: BinanceConfig -> BS.ByteString -> BS.ByteString -> BS.ByteString+-- | Generate a HMAC "Crpto.Hash.SHA256" signature for a @SIGNED@ api+-- request.+mkSignature+ :: BinanceConfig+ -- ^ API Credentials+ -> BS.ByteString+ -- ^ Query parameters (with no leading @?@)+ -> BS.ByteString+ -- ^ Request body+ -> BS.ByteString mkSignature cfg queryParams reqBody = let totalParams = queryParams <> reqBody key = encodeUtf8 $ bcApiSecret cfg
tests/Spec.hs view
@@ -25,7 +25,7 @@ properties :: TestTree properties = testGroup "Properties"- [testProperty "Addition is Communative" testAdditionCommunative]+ [testPropertyNamed "Addition is Communative" "testAdditionCommunative" testAdditionCommunative] where testAdditionCommunative :: Property testAdditionCommunative = property $ do