Trading With Alpaca and Golang

Alpaca is a popular platform for automated trading, offering APIs for accessing real-time market data and placing trades. In this article, we will discuss how to use Alpaca’s APIs with Golang, a popular programming language known for its simplicity, performance, and concurrency support. Before we dive into the details of using Alpaca’s APIs with Golang, let’s first understand the requirements of the application. Requirements The application should be able to connect to the Alpaca API and authenticate the user. The application should be able to retrieve real-time market data and place trades. The application should be able to retrieve the user’s account information and trade history. ...

January 15, 2023 · 3 min · 595 words

Unit Testing in Golang

Unit testing is a software testing technique in which individual units (smallest testable parts) of a software application are tested in isolation from the rest of the application. The goal of unit testing is to validate that each unit of the application is working as intended and meets the specified requirements. In Go, the testing package provides support for writing unit tests. To write unit tests, you need to create a file with a name that ends in _test.go and place it in the same package as the code you want to test. The testing package also provides a testing.T type that represents a testing context and has methods for reporting test failures and logging messages. ...

January 9, 2023 · 3 min · 634 words

Streaming Video With Golang

Streaming video with Go (Golang) is a popular choice for building efficient and scalable video streaming applications. In this blog post, we’ll discuss some of the key concepts and considerations for building a video streaming application with Go. One of the first things to consider when building a video streaming application is the underlying video format. Go has built-in support for working with a variety of video formats, including MP4, FLV, and AVI. However, the most common format for streaming video is probably H.264, which is a popular choice due to its high compression ratio and wide compatibility with a variety of devices and platforms. ...

January 4, 2023 · 5 min · 1063 words

The Context Package

Context in Go is a type that carries a request-scoped value across API boundaries. It is designed to be used in long-lived requests, such as an HTTP server handling multiple requests over the lifetime of a process. One of the primary use cases of context is to cancel long-running operations. For example, if an HTTP server receives a request with a cancelation token, it can use that token to cancel the request if the client closes the connection. This helps to avoid resource leaks by freeing up resources that would have been used by the request. ...

January 3, 2023 · 4 min · 771 words

Use Protobuf With Golang

Protocol Buffers (Protobuf) is a language- and platform-neutral data serialization format developed by Google. It allows you to define data structures in a .proto file and then use code generation tools to generate code in various languages for working with those data structures. To use Protobuf with Go, you’ll need to do the following: Install the Protobuf compiler (protoc) and the Go Protobuf plugin: # Install protoc wget https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/protoc-3.14.0-linux-x86_64.zip unzip protoc-3.14.0-linux-x86_64.zip -d protoc3 sudo mv protoc3/bin/* /usr/local/bin/ # Install the Go Protobuf plugin go get -u github.com/golang/protobuf/protoc-gen-go Define your data structures in a .proto file. For example: ...

December 27, 2022 · 2 min · 425 words